Skip to content

Commit b4d85f9

Browse files
rjp@backup.frottage.org.frottage.orgrjp
authored andcommitted
- branch merge
1 parent a89405c commit b4d85f9

39 files changed

+16811
-5
lines changed

.hgignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
letters/*
1+
.*/letters/.*
2+
.*/11/history/.*
3+
.*/11/svg/.*

10/derbydown.rb

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
table = {}
2+
3+
def show(table)
4+
temp = []
5+
a=%w{Ps Team P W D L GF GA GD P}
6+
printf "%2s %-20s %2s %2s %2s %2s %2s %2s %4s %2s\n", *a
7+
new = table.keys.sort_by {|i| 1000*table[i][:points] + table[i][:gf] - table[i][:ga]}.reverse
8+
new.each_with_index {|team,i|
9+
r = table[team]
10+
r[:pos] = i+1
11+
printf "%2s %-20s %2d %2d %2d %2d %2d %2d %4d %2d\n",
12+
r[:pos], team, r[:played], r[:won], r[:drawn], r[:lost], r[:gf], r[:ga], r[:gf]-r[:ga], r[:points]
13+
temp[i+1] = team
14+
}
15+
if table['Derby'][:pos].to_i != 20 then
16+
puts "DERBY ARE NOT BOTTOM"
17+
end
18+
if table[temp[19]][:points] > table['Derby'][:points] + 3*(38-table['Derby'][:played]) then
19+
puts "DERBY ARE RELEGATED"
20+
end
21+
end
22+
23+
def loss_for(x, table)
24+
table[x][:points] = table[x][:points] + 3
25+
table[x][:won] = table[x][:won] + 1
26+
table[x][:played] = table[x][:played] + 1
27+
table[x][:gf] = table[x][:gf] + 1
28+
end
29+
30+
def win_for(x, table)
31+
table[x][:lost] = table[x][:lost] + 1
32+
table[x][:played] = table[x][:played] + 1
33+
table[x][:ga] = table[x][:ga] + 1
34+
end
35+
36+
def draw_for(x, y, table)
37+
table[x][:points] = table[x][:points] + 1
38+
table[x][:drawn] = table[x][:drawn] + 1
39+
table[x][:played] = table[x][:played] + 1
40+
table[y][:points] = table[y][:points] + 1
41+
table[y][:drawn] = table[y][:drawn] + 1
42+
table[y][:played] = table[y][:played] + 1
43+
end
44+
45+
File.open("table") { |f|
46+
f.readlines.each { |l|
47+
pos, team, played, won, drawn, lost, goals_for, goals_against, *junk = l.gsub(/\t+/, ' ').split ' '
48+
points = junk[-1]
49+
table[team] = { :pos => pos.to_i, :played => played.to_i, :won => won.to_i, :drawn => drawn.to_i, :lost => lost.to_i, :gf => goals_for.to_i, :ga => goals_against.to_i, :points => points.to_i }
50+
}
51+
}
52+
53+
max_points = table['Derby'][:points] + 3*(38-table['Derby'][:played])
54+
55+
File.open("fixtures") { |f|
56+
f.readlines.each { |l|
57+
if l =~ /(.*?) v (.+)/ then
58+
t_away = $2
59+
home = $1.gsub(/ /, '_') # this will blat $2
60+
away = t_away.gsub(/ /, '_')
61+
puts "#{home} (#{table[home][:pos]}, #{table[home][:points]}) v #{away} (#{table[away][:pos]}, #{table[away][:points]}) D(#{table['Derby'][:pos]}, #{table['Derby'][:points]})"
62+
if home == 'Derby' then
63+
win_for home, table
64+
loss_for away, table
65+
puts "Derby win at home"
66+
elsif away == 'Derby'
67+
loss_for home, table
68+
win_for away, table
69+
puts "Derby win away"
70+
else
71+
if table[home][:points] > max_points then # Derby can never overhaul these people
72+
if table[away][:points] > max_points then # or these people so let them draw
73+
puts "#{home} v #{away} non-reachable draw"
74+
draw_for home, away, table
75+
else
76+
puts "#{home} (non-reachable) beat #{away} (reachable)"
77+
win_for home, table
78+
loss_for away, table
79+
end
80+
elsif table[away][:points] > max_points then # or these people so let them draw
81+
if table[home][:points] > max_points then # Derby can never overhaul these people
82+
puts "#{home} v #{away} non-reachable draw (2)"
83+
draw_for home, away, table
84+
else
85+
puts "#{away} (non-reachable) beat #{home} (reachable)"
86+
loss_for home, table
87+
win_for away, table
88+
end
89+
elsif table[home][:pos] > table['Derby'][:pos] then
90+
if table[home][:points] + 4 < table['Derby'][:points] then
91+
puts "#{home} beat #{away} because < Derby on pos, points"
92+
win_for home, table
93+
loss_for away, table
94+
else
95+
draw_for home, away, table
96+
end
97+
elsif table[away][:pos] > table['Derby'][:pos] then
98+
if table[away][:points] + 4 < table['Derby'][:points] then
99+
puts "#{away} beat #{home} because < Derby on pos, points"
100+
loss_for home, table
101+
win_for away, table
102+
else
103+
puts "#{home} draw with #{away}"
104+
draw_for home, away, table
105+
end
106+
elsif table[home][:pos] > table['Derby'][:pos] - 3 then
107+
if table[away][:pos] < table['Derby'][:pos] - 4 then
108+
puts "#{away} draw with #{home}, both close"
109+
draw_for home, away, table
110+
else
111+
puts "#{away} beat #{home} because home is close"
112+
win_for away, table
113+
loss_for home, table
114+
end
115+
elsif table[away][:pos] > table['Derby'][:pos] - 3 then
116+
if table[home][:pos] < table['Derby'][:pos] - 3 then
117+
puts "#{home} draw with #{away}, both close"
118+
draw_for home, away, table
119+
else
120+
puts "#{home} beat #{away} because away is close"
121+
win_for home, table
122+
loss_for away, table
123+
end
124+
elsif table[home][:pos] < 6 then
125+
puts "#{home} beat #{away} because top-5"
126+
win_for home, table
127+
loss_for away, table
128+
elsif table[away][:pos] < 6 then
129+
puts "#{away} beat #{home} because top-5"
130+
loss_for home, table
131+
win_for away, table
132+
else
133+
puts "#{home} draw with #{away}"
134+
draw_for home, away, table
135+
end
136+
end
137+
end
138+
if l =~ /2008/ then
139+
show table
140+
end
141+
}
142+
}
143+
show table

10/fixtures

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
Saturday, 23 February 2008
2+
Blackburn v Bolton
3+
Man City v Everton
4+
Reading v Aston Villa
5+
6+
Saturday, 1 March 2008
7+
Arsenal v Aston Villa
8+
Birmingham v Tottenham
9+
Bolton v Liverpool
10+
Derby v Sunderland
11+
Everton v Portsmouth
12+
Fulham v Man Utd
13+
Man City v Wigan
14+
Middlesbrough v Reading
15+
Newcastle v Blackburn
16+
West Ham v Chelsea
17+
18+
Saturday, 8 March 2008
19+
Aston Villa v Middlesbrough
20+
Blackburn v Fulham
21+
Chelsea v Derby
22+
Liverpool v Newcastle
23+
Man Utd v Bolton
24+
Portsmouth v Birmingham
25+
Reading v Man City
26+
Sunderland v Everton
27+
Tottenham v West Ham
28+
Wigan v Arsenal
29+
30+
Wednesday, 12 March 2008
31+
Tottenham v Chelsea
32+
Liverpool v West Ham
33+
34+
Saturday, 15 March 2008
35+
Arsenal v Middlesbrough
36+
Birmingham v Newcastle
37+
Derby v Man Utd
38+
Fulham v Everton
39+
Liverpool v Reading
40+
Man City v Tottenham
41+
Portsmouth v Aston Villa
42+
Sunderland v Chelsea
43+
West Ham v Blackburn
44+
Wigan v Bolton
45+
46+
Saturday, 22 March 2008
47+
Aston Villa v Sunderland
48+
Blackburn v Wigan
49+
Bolton v Man City
50+
Chelsea v Arsenal
51+
Everton v West Ham
52+
Man Utd v Liverpool
53+
Middlesbrough v Derby
54+
Newcastle v Fulham
55+
Reading v Birmingham
56+
Tottenham v Portsmouth
57+
58+
Saturday, 29 March 2008
59+
Birmingham v Man City
60+
Bolton v Arsenal
61+
Chelsea v Middlesbrough
62+
Derby v Fulham
63+
Liverpool v Everton
64+
Man Utd v Aston Villa
65+
Portsmouth v Wigan
66+
Reading v Blackburn
67+
Sunderland v West Ham
68+
Tottenham v Newcastle
69+
70+
Saturday, 5 April 2008
71+
Arsenal v Liverpool
72+
Aston Villa v Bolton
73+
Blackburn v Tottenham
74+
Everton v Derby
75+
Fulham v Sunderland
76+
Man City v Chelsea
77+
Middlesbrough v Man Utd
78+
Newcastle v Reading
79+
West Ham v Portsmouth
80+
Wigan v Birmingham
81+
82+
Saturday, 12 April 2008
83+
Birmingham v Everton
84+
Bolton v West Ham
85+
Chelsea v Wigan
86+
Derby v Aston Villa
87+
Liverpool v Blackburn
88+
Man Utd v Arsenal
89+
Portsmouth v Newcastle
90+
Reading v Fulham
91+
Sunderland v Man City
92+
Tottenham v Middlesbrough
93+
94+
Saturday, 19 April 2008
95+
Arsenal v Reading
96+
Aston Villa v Birmingham
97+
Blackburn v Man Utd
98+
Everton v Chelsea
99+
Fulham v Liverpool
100+
Man City v Portsmouth
101+
Middlesbrough v Bolton
102+
Newcastle v Sunderland
103+
West Ham v Derby
104+
Wigan v Tottenham
105+
106+
Saturday, 26 April 2008
107+
Birmingham v Liverpool
108+
Chelsea v Man Utd
109+
Derby v Arsenal
110+
Everton v Aston Villa
111+
Man City v Fulham
112+
Portsmouth v Blackburn
113+
Sunderland v Middlesbrough
114+
Tottenham v Bolton
115+
West Ham v Newcastle
116+
Wigan v Reading
117+
118+
Saturday, 3 May 2008
119+
Arsenal v Everton
120+
Aston Villa v Wigan
121+
Blackburn v Derby
122+
Bolton v Sunderland
123+
Fulham v Birmingham
124+
Liverpool v Man City
125+
Man Utd v West Ham
126+
Middlesbrough v Portsmouth
127+
Newcastle v Chelsea
128+
Reading v Tottenham
129+
130+
Sunday, 11 May 2008
131+
Birmingham v Blackburn
132+
Chelsea v Bolton
133+
Derby v Reading
134+
Everton v Middlesbrough
135+
Man City v Newcastle
136+
Portsmouth v Fulham
137+
Sunderland v Arsenal
138+
Tottenham v Liverpool
139+
West Ham v Aston Villa
140+
Wigan v Man Utd

10/table

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
1 Arsenal 27 19 7 1 56 20 12 2 0 31 8 7 5 1 25 12 36 64
2+
2 Man_Utd 27 19 4 4 55 15 12 1 1 32 5 7 3 3 23 10 40 61
3+
3 Chelsea 26 16 7 3 38 17 8 5 0 23 8 8 2 3 15 9 21 55
4+
4 Liverpool 26 12 11 3 43 19 6 6 1 29 11 6 5 2 14 8 24 47
5+
5 Everton 26 14 5 7 41 23 8 2 3 24 11 6 3 4 17 12 18 47
6+
6 Aston_Villa 26 12 8 6 48 34 8 2 4 24 17 4 6 2 24 17 14 44
7+
7 Portsmouth 27 12 8 7 37 26 4 7 2 16 10 8 1 5 21 16 11 44
8+
8 Man_City 26 12 8 6 34 29 9 3 1 21 11 3 5 5 13 18 5 44
9+
9 West_Ham 26 11 7 8 31 23 5 5 3 16 13 6 2 5 15 10 8 40
10+
10 Blackburn 26 10 9 7 32 33 5 4 4 13 13 5 5 3 19 20 -1 39
11+
11 Tottenham 26 8 8 10 48 41 6 2 4 33 22 2 6 6 15 19 7 32
12+
12 Middlesbrough 27 7 8 12 25 41 4 4 5 14 18 3 4 7 11 23 -16 29
13+
13 Newcastle 27 7 7 13 30 52 5 5 4 18 23 2 2 9 12 29 -22 28
14+
14 Wigan 27 7 5 15 26 42 6 2 5 17 14 1 3 10 9 28 -16 26
15+
15 Sunderland 27 7 5 15 26 46 7 3 3 17 13 0 2 12 9 33 -20 26
16+
16 Bolton 26 6 7 13 26 35 5 4 5 17 12 1 3 8 9 23 -9 25
17+
17 Birmingham 27 5 8 14 27 40 3 5 5 15 16 2 3 9 12 24 -13 23
18+
18 Reading 26 6 4 16 30 53 6 1 6 14 19 0 3 10 16 34 -23 22
19+
19 Fulham 27 3 10 14 25 45 3 5 6 18 23 0 5 8 7 22 -20 19
20+
20 Derby 27 1 6 20 13 57 1 3 9 8 24 0 3 11 5 33 -44 33

0 commit comments

Comments
 (0)