tournament 4.2.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/README.rdoc +108 -108
- data/bin/gui.rb +7 -4
- data/lib/tournament.rb +1 -1
- data/webgui/public/images/2012FinalFour.jpg +0 -0
- data/webgui/public/stylesheets/bracket.css +1 -1
- metadata +14 -13
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -21,120 +21,15 @@ basketball tournament pool.
|
|
21
21
|
adjunct to the command line script.
|
22
22
|
* FIXME: Complete the test suite for the library and command line tool
|
23
23
|
|
24
|
-
== COMMAND LINE SYNOPSIS:
|
25
|
-
|
26
|
-
The tournament command line program is installed as 'pool'. The library
|
27
|
-
has the 2010 NCAA tournament pre-configured. If you were to use
|
28
|
-
this library for the 2011 NCAA tournament, code changes would be
|
29
|
-
necessary. FIXME: (add ability to read teams from a simple configuration
|
30
|
-
file). For usage, just execute
|
31
|
-
|
32
|
-
pool --help
|
33
|
-
|
34
|
-
For command specific usage, execute
|
35
|
-
|
36
|
-
pool [command] --help
|
37
|
-
|
38
|
-
where [command] is one of the available commands described below. The
|
39
|
-
pool command saves state in a file called pool.yml by default. This
|
40
|
-
can be overridden in all cases by using the --save-file option.
|
41
|
-
|
42
|
-
The pool manager would use this program as follows:
|
43
|
-
|
44
|
-
1. Choose a scoring strategy. There are various scoring strategies
|
45
|
-
that could be used. The library comes pre-configured with
|
46
|
-
three scoring strategies:
|
47
|
-
1. Basic scoring strategy: each correct pick is worth 2 X the round.
|
48
|
-
2. Upset favoring strategy: each correct pick is worth a
|
49
|
-
base amount per round plus the seed number of the winner. As
|
50
|
-
pre-configured, the base amounts per round are 3, 5, 11, 19, 30
|
51
|
-
and 40 points.
|
52
|
-
3. The Josh Patashnik strategy: each correct pick is worth the
|
53
|
-
winner's seed number X a round multiplier. The multipliers
|
54
|
-
are 1, 2, 4, 8, 16 and 32 points.
|
55
|
-
4. Tweaked Josh Patashnik strategy: each correct pick is worth the
|
56
|
-
winner's seed number X a round multiplier. The multipliers
|
57
|
-
are 1, 2, 4, 8, 12 and 22 points.
|
58
|
-
4. Constant Value strategy: each correct pick is worth exactly
|
59
|
-
one (1) point, regardless of round.
|
60
|
-
If your scoring strategy is not one of the above, you will have to
|
61
|
-
add a class to the ScoringStrategy module, in file
|
62
|
-
lib/tournament/scoring_strategy.rb.
|
63
|
-
|
64
|
-
2. Create a directory to hold the pool data and change to it
|
65
|
-
|
66
|
-
3. Initialize the pool
|
67
|
-
|
68
|
-
pool setup [--scoring=upset]
|
69
|
-
|
70
|
-
Use the --scoring argument to change from the default basic scoring
|
71
|
-
strategy. If the basic strategy is ok, the --scoring argument is
|
72
|
-
not required.
|
73
|
-
|
74
|
-
As mentioned above, unless overridden by using the --save-file
|
75
|
-
option, the pool will save itself to the file 'pool.yml'
|
76
|
-
|
77
|
-
4. Set the entry fee and payout amounts
|
78
|
-
|
79
|
-
pool fee 10
|
80
|
-
pool payout 1 80
|
81
|
-
pool payout 2 20
|
82
|
-
pool payout last 10 -C
|
83
|
-
|
84
|
-
The above commands say that each entry fee is 10 units (this is all
|
85
|
-
for fun, not profit, right?) and that the 1st place finisher would
|
86
|
-
receive 80% of the total payout, the 2nd place finisher would
|
87
|
-
receive 20% of the total payout and the last place finisher would
|
88
|
-
receive 10 units back (would get her entry fee back). No error
|
89
|
-
checking is done with this. FIXME: Add error checking.
|
90
|
-
|
91
|
-
5. Export a tournament entry YAML file
|
92
|
-
|
93
|
-
pool dump
|
94
|
-
|
95
|
-
This will save the tournament entry file as tournament.yml unless
|
96
|
-
the --entry option is used to override it.
|
97
|
-
|
98
|
-
6. Create entries. You can use the included buggy GUI (see below),
|
99
|
-
or edit YAML files by hand.
|
100
|
-
|
101
|
-
7. Import the entry YAML files into the pool
|
102
|
-
|
103
|
-
pool entry --add=path/to/entry.yml
|
104
|
-
|
105
|
-
8. As games progress, update the tournament.yml file, again using the GUI or
|
106
|
-
editing the YAML file by hand. Then update the pool with the new
|
107
|
-
pool YAML file
|
108
|
-
|
109
|
-
pool update
|
110
|
-
|
111
|
-
9. Run reports
|
112
|
-
|
113
|
-
pool report [final_four|entry|region|leader|score]
|
114
|
-
|
115
|
-
The final four report can only be run once the final four teams have
|
116
|
-
been determined.
|
117
|
-
|
118
|
-
10. After about 22 teams are left, run a possibility report. This report will
|
119
|
-
run through all the remaining ways the tournament can come out and
|
120
|
-
calculate the chance to win for each player. The chance to win
|
121
|
-
is defined as the percentage of possibilities that lead to that player
|
122
|
-
coming out on top in the pool. With more than about 22 teams left
|
123
|
-
(YMMV), this report could take months to run. FIXME (Investigate
|
124
|
-
possibly using EC2 or something to spread the load around, or
|
125
|
-
otherwise optimize the possibility checking algorithm)
|
126
|
-
|
127
|
-
pool report possibility
|
128
|
-
|
129
24
|
== WEB GUI:
|
130
25
|
|
131
|
-
A Rails web application is available
|
132
|
-
|
26
|
+
A Rails web application is available for collecting entries and
|
27
|
+
running reports during the course of the pool.
|
133
28
|
|
134
29
|
=== INSTALLING THE WEB GUI:
|
135
30
|
|
136
31
|
The web application can be installed by running the pool command
|
137
|
-
as follows
|
32
|
+
(see command line synopsis below) as follows
|
138
33
|
|
139
34
|
pool install_webgui --web-dir=/path/to/directory [options]
|
140
35
|
|
@@ -298,6 +193,111 @@ on the server:
|
|
298
193
|
|
299
194
|
RAILS_ENV=production rake report:possibilities
|
300
195
|
|
196
|
+
== COMMAND LINE SYNOPSIS:
|
197
|
+
|
198
|
+
The tournament command line program is installed as 'pool'. The library
|
199
|
+
has the 2010 NCAA tournament pre-configured. If you were to use
|
200
|
+
this library for the 2011 NCAA tournament, code changes would be
|
201
|
+
necessary. FIXME: (add ability to read teams from a simple configuration
|
202
|
+
file). For usage, just execute
|
203
|
+
|
204
|
+
pool --help
|
205
|
+
|
206
|
+
For command specific usage, execute
|
207
|
+
|
208
|
+
pool [command] --help
|
209
|
+
|
210
|
+
where [command] is one of the available commands described below. The
|
211
|
+
pool command saves state in a file called pool.yml by default. This
|
212
|
+
can be overridden in all cases by using the --save-file option.
|
213
|
+
|
214
|
+
The pool manager would use this program as follows:
|
215
|
+
|
216
|
+
1. Choose a scoring strategy. There are various scoring strategies
|
217
|
+
that could be used. The library comes pre-configured with
|
218
|
+
three scoring strategies:
|
219
|
+
1. Basic scoring strategy: each correct pick is worth 2 X the round.
|
220
|
+
2. Upset favoring strategy: each correct pick is worth a
|
221
|
+
base amount per round plus the seed number of the winner. As
|
222
|
+
pre-configured, the base amounts per round are 3, 5, 11, 19, 30
|
223
|
+
and 40 points.
|
224
|
+
3. The Josh Patashnik strategy: each correct pick is worth the
|
225
|
+
winner's seed number X a round multiplier. The multipliers
|
226
|
+
are 1, 2, 4, 8, 16 and 32 points.
|
227
|
+
4. Tweaked Josh Patashnik strategy: each correct pick is worth the
|
228
|
+
winner's seed number X a round multiplier. The multipliers
|
229
|
+
are 1, 2, 4, 8, 12 and 22 points.
|
230
|
+
4. Constant Value strategy: each correct pick is worth exactly
|
231
|
+
one (1) point, regardless of round.
|
232
|
+
If your scoring strategy is not one of the above, you will have to
|
233
|
+
add a class to the ScoringStrategy module, in file
|
234
|
+
lib/tournament/scoring_strategy.rb.
|
235
|
+
|
236
|
+
2. Create a directory to hold the pool data and change to it
|
237
|
+
|
238
|
+
3. Initialize the pool
|
239
|
+
|
240
|
+
pool setup [--scoring=upset]
|
241
|
+
|
242
|
+
Use the --scoring argument to change from the default basic scoring
|
243
|
+
strategy. If the basic strategy is ok, the --scoring argument is
|
244
|
+
not required.
|
245
|
+
|
246
|
+
As mentioned above, unless overridden by using the --save-file
|
247
|
+
option, the pool will save itself to the file 'pool.yml'
|
248
|
+
|
249
|
+
4. Set the entry fee and payout amounts
|
250
|
+
|
251
|
+
pool fee 10
|
252
|
+
pool payout 1 80
|
253
|
+
pool payout 2 20
|
254
|
+
pool payout last 10 -C
|
255
|
+
|
256
|
+
The above commands say that each entry fee is 10 units (this is all
|
257
|
+
for fun, not profit, right?) and that the 1st place finisher would
|
258
|
+
receive 80% of the total payout, the 2nd place finisher would
|
259
|
+
receive 20% of the total payout and the last place finisher would
|
260
|
+
receive 10 units back (would get her entry fee back). No error
|
261
|
+
checking is done with this. FIXME: Add error checking.
|
262
|
+
|
263
|
+
5. Export a tournament entry YAML file
|
264
|
+
|
265
|
+
pool dump
|
266
|
+
|
267
|
+
This will save the tournament entry file as tournament.yml unless
|
268
|
+
the --entry option is used to override it.
|
269
|
+
|
270
|
+
6. Create entries. You can use the included buggy GUI (see below),
|
271
|
+
or edit YAML files by hand.
|
272
|
+
|
273
|
+
7. Import the entry YAML files into the pool
|
274
|
+
|
275
|
+
pool entry --add=path/to/entry.yml
|
276
|
+
|
277
|
+
8. As games progress, update the tournament.yml file, again using the GUI or
|
278
|
+
editing the YAML file by hand. Then update the pool with the new
|
279
|
+
pool YAML file
|
280
|
+
|
281
|
+
pool update
|
282
|
+
|
283
|
+
9. Run reports
|
284
|
+
|
285
|
+
pool report [final_four|entry|region|leader|score]
|
286
|
+
|
287
|
+
The final four report can only be run once the final four teams have
|
288
|
+
been determined.
|
289
|
+
|
290
|
+
10. After about 22 teams are left, run a possibility report. This report will
|
291
|
+
run through all the remaining ways the tournament can come out and
|
292
|
+
calculate the chance to win for each player. The chance to win
|
293
|
+
is defined as the percentage of possibilities that lead to that player
|
294
|
+
coming out on top in the pool. With more than about 22 teams left
|
295
|
+
(YMMV), this report could take months to run. FIXME (Investigate
|
296
|
+
possibly using EC2 or something to spread the load around, or
|
297
|
+
otherwise optimize the possibility checking algorithm)
|
298
|
+
|
299
|
+
pool report possibility
|
300
|
+
|
301
301
|
== SHOES GUI (Deprecated):
|
302
302
|
|
303
303
|
A GUI for filling out tournment bracket entries is included and is run
|
data/bin/gui.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#!/usr/bin/env
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'green_shoes'
|
2
4
|
|
3
5
|
Dir.chdir(File.join(File.dirname(__FILE__), '..'))
|
4
6
|
|
@@ -30,7 +32,7 @@ Shoes.app :width => WINDOW_WIDTH, :height => 600 do
|
|
30
32
|
load_data
|
31
33
|
else
|
32
34
|
@entry = Tournament::Entry.new
|
33
|
-
@entry.picks = Tournament::Bracket.new(@pool.
|
35
|
+
@entry.picks = Tournament::Bracket.new(@pool.tournament_entry.picks.teams)
|
34
36
|
#@picks = Tournament::Bracket.random_bracket(Tournament::Pool.ncaa_2008.bracket.teams)
|
35
37
|
end
|
36
38
|
|
@@ -71,6 +73,7 @@ Shoes.app :width => WINDOW_WIDTH, :height => 600 do
|
|
71
73
|
"%4s" % team.short_name
|
72
74
|
end
|
73
75
|
end
|
76
|
+
return label.gsub("&", "&")
|
74
77
|
end
|
75
78
|
|
76
79
|
def matchup_flow(region_idx, round, game, real_game, bc, gap)
|
@@ -172,11 +175,11 @@ Shoes.app :width => WINDOW_WIDTH, :height => 600 do
|
|
172
175
|
end
|
173
176
|
stack do
|
174
177
|
para "Name"
|
175
|
-
@name = edit_line @entry.name
|
178
|
+
@name = edit_line :text => @entry.name
|
176
179
|
end
|
177
180
|
stack do
|
178
181
|
para "Tie Breaker"
|
179
|
-
@tie_break = edit_line "#{@entry.tie_breaker}"
|
182
|
+
@tie_break = edit_line :text => "#{@entry.tie_breaker}"
|
180
183
|
end
|
181
184
|
end
|
182
185
|
@pool.regions.each_with_index do |region, region_idx|
|
data/lib/tournament.rb
CHANGED
Binary file
|
@@ -4,7 +4,7 @@ TABLE.bracket
|
|
4
4
|
BORDER-TOP: black 1px solid;
|
5
5
|
BORDER-LEFT: black 1px solid;
|
6
6
|
BORDER-BOTTOM: black 1px solid;
|
7
|
-
background: white url(../images/
|
7
|
+
background: white url(../images/2012FinalFour.jpg) center no-repeat;
|
8
8
|
}
|
9
9
|
|
10
10
|
TABLE.bracket TH.header
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tournament
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,23 +9,23 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-03-09 00:00:00.000000000 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: main
|
17
|
-
requirement: &
|
17
|
+
requirement: &70317973692360 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 5.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70317973692360
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rake
|
28
|
-
requirement: &
|
28
|
+
requirement: &70317973691800 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 0.8.7
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70317973691800
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rails
|
39
|
-
requirement: &
|
39
|
+
requirement: &70317973691300 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - =
|
@@ -44,18 +44,18 @@ dependencies:
|
|
44
44
|
version: 2.3.11
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70317973691300
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: bones
|
50
|
-
requirement: &
|
50
|
+
requirement: &70317973690820 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 3.
|
55
|
+
version: 3.7.3
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70317973690820
|
59
59
|
description: ! 'Small library, command line program and Rails web GUI for managing
|
60
60
|
a NCAA
|
61
61
|
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- webgui/public/images/2009FinalFour.png
|
209
209
|
- webgui/public/images/2010FinalFour.jpg
|
210
210
|
- webgui/public/images/2011FinalFour.jpg
|
211
|
+
- webgui/public/images/2012FinalFour.jpg
|
211
212
|
- webgui/public/images/rails.png
|
212
213
|
- webgui/public/javascripts/application.js
|
213
214
|
- webgui/public/javascripts/bracket.js
|
@@ -374,5 +375,5 @@ specification_version: 3
|
|
374
375
|
summary: Small library, command line program and Rails web GUI for managing a NCAA
|
375
376
|
basketball tournament pool.
|
376
377
|
test_files:
|
377
|
-
- test/test_webgui_installer.rb
|
378
378
|
- test/test_tournament.rb
|
379
|
+
- test/test_webgui_installer.rb
|