tournament 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/README.txt +8 -3
- data/Rakefile +1 -1
- data/bin/pool +1 -1
- data/lib/tournament/scoring_strategy.rb +37 -4
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 2.1.2 / 2009-03-16
|
2
|
+
* Add two new scoring strategies.
|
3
|
+
* Another release forthcoming when play-in game is decided.
|
4
|
+
|
1
5
|
== 2.1.1 / 2009-03-16
|
2
6
|
* Fix bug when changing entry name after it has been completed
|
3
7
|
and therefore added to the backing Tournament::Pool object
|
data/README.txt
CHANGED
@@ -48,9 +48,14 @@ The pool manager would use this program as follows:
|
|
48
48
|
base amount per round plus the seed number of the winner. As
|
49
49
|
pre-configured, the base amounts per round are 3, 5, 11, 19, 30
|
50
50
|
and 40 points.
|
51
|
-
3. The Josh Patashnik
|
51
|
+
3. The Josh Patashnik strategy: each correct pick is worth the
|
52
52
|
winner's seed number X a round multiplier. The multipliers
|
53
53
|
are 1, 2, 4, 8, 16 and 32 points.
|
54
|
+
4. Tweaked Josh Patashnik strategy: each correct pick is worth the
|
55
|
+
winner's seed number X a round multiplier. The multipliers
|
56
|
+
are 1, 2, 4, 8, 12 and 22 points.
|
57
|
+
4. Constant Value strategy: each correct pick is worth exactly
|
58
|
+
one (1) point, regardless of round.
|
54
59
|
If your scoring strategy is not one of the above, you will have to
|
55
60
|
add a class to the ScoringStrategy module, in file
|
56
61
|
lib/tournament/scoring_strategy.rb.
|
@@ -59,9 +64,9 @@ The pool manager would use this program as follows:
|
|
59
64
|
|
60
65
|
3. Initialize the pool
|
61
66
|
|
62
|
-
pool setup [--scoring=
|
67
|
+
pool setup [--scoring=upset]
|
63
68
|
|
64
|
-
Use the --scoring argument to change
|
69
|
+
Use the --scoring argument to change from the default basic scoring
|
65
70
|
strategy. If the basic strategy is ok, the --scoring argument is
|
66
71
|
not required.
|
67
72
|
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ PROJ.authors = 'Douglas A. Seifert'
|
|
20
20
|
PROJ.email = 'doug+rubyforge@dseifert.net'
|
21
21
|
PROJ.url = 'http://www.dseifert.net/code/tournament'
|
22
22
|
PROJ.rubyforge.name = 'tournament'
|
23
|
-
PROJ.version = '2.1.
|
23
|
+
PROJ.version = '2.1.2'
|
24
24
|
PROJ.group_id = 5863
|
25
25
|
|
26
26
|
PROJ.spec.opts << '--color'
|
data/bin/pool
CHANGED
@@ -164,7 +164,7 @@ Main do
|
|
164
164
|
optional
|
165
165
|
argument :required
|
166
166
|
arity 1
|
167
|
-
default '
|
167
|
+
default 'basic'
|
168
168
|
validate {|s| Tournament::ScoringStrategy.available_strategies.include?(s)}
|
169
169
|
description "Sets the scoring strategy, should be one of #{Tournament::ScoringStrategy.available_strategies.join(', ')}"
|
170
170
|
end
|
@@ -12,7 +12,21 @@ module Tournament::ScoringStrategy
|
|
12
12
|
'Basic'
|
13
13
|
end
|
14
14
|
def description
|
15
|
-
"Each
|
15
|
+
"Each correct pick is worth 2 times the round number."
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Class representing a scoring strategy where correct picks
|
20
|
+
# are worth 1 point each, regardless of round
|
21
|
+
class ConstantValue
|
22
|
+
def score(pick, winner, loser, round)
|
23
|
+
winner != Tournament::Bracket::UNKNOWN_TEAM && pick == winner ? 1 : 0
|
24
|
+
end
|
25
|
+
def name
|
26
|
+
'Constant Value'
|
27
|
+
end
|
28
|
+
def description
|
29
|
+
"Each correct pick is worth 1 point, regardless of the round."
|
16
30
|
end
|
17
31
|
end
|
18
32
|
|
@@ -31,7 +45,7 @@ module Tournament::ScoringStrategy
|
|
31
45
|
'Upset'
|
32
46
|
end
|
33
47
|
def description
|
34
|
-
"
|
48
|
+
"Each correct pick is worth #{PER_ROUND.join(', ')} per round plus the seed number of the winning team."
|
35
49
|
end
|
36
50
|
end
|
37
51
|
|
@@ -50,14 +64,33 @@ module Tournament::ScoringStrategy
|
|
50
64
|
'Josh Patashnik'
|
51
65
|
end
|
52
66
|
def description
|
53
|
-
"
|
67
|
+
"Each correct pick is worth the seed number of the winning team times a per round multiplier: #{MULTIPLIERS.join(', ')}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Class representing a scoring strategy where correct picks are
|
72
|
+
# worth the seed number of the winner times a per round
|
73
|
+
# multiplier (1,2,4,8,12,22)
|
74
|
+
class TweakedJoshPatashnik
|
75
|
+
MULTIPLIERS = [1, 2, 4, 8, 12, 22]
|
76
|
+
def score(pick, winner, loser, round)
|
77
|
+
if winner != Tournament::Bracket::UNKNOWN_TEAM && pick == winner
|
78
|
+
return MULTIPLIERS[round-1] * winner.seed
|
79
|
+
end
|
80
|
+
return 0
|
81
|
+
end
|
82
|
+
def name
|
83
|
+
'Tweaked Josh Patashnik'
|
84
|
+
end
|
85
|
+
def description
|
86
|
+
"Each correct pick is worth the seed number of the winning team times a per round multiplier: #{MULTIPLIERS.join(', ')}"
|
54
87
|
end
|
55
88
|
end
|
56
89
|
|
57
90
|
# Returns names of available strategies. The names returned are suitable
|
58
91
|
# for use in the strategy_for_name method
|
59
92
|
def self.available_strategies
|
60
|
-
return ['basic', 'upset', 'josh_patashnik']
|
93
|
+
return ['basic', 'upset', 'josh_patashnik', 'tweaked_josh_patashnik', 'constant_value']
|
61
94
|
end
|
62
95
|
|
63
96
|
# Returns an instantiated strategy class for the named strategy.
|