Change neededGames to needed_games
This commit is contained in:
parent
c2814a0faf
commit
a13b8e0c72
|
|
@ -4,18 +4,18 @@ module Turniere
|
||||||
if teams.size == 1
|
if teams.size == 1
|
||||||
return #TODO error with only one team
|
return #TODO error with only one team
|
||||||
end
|
end
|
||||||
neededGames = 0
|
needed_games = 0
|
||||||
if (Turniere::Utils.po2?(teams.size())
|
if (Turniere::Utils.po2?(teams.size())
|
||||||
neededGames = teams.size() / 2
|
needed_games = teams.size() / 2
|
||||||
else
|
else
|
||||||
neededGames = teams.size() - Turniere::Utils.previous_power_of_two(teams.size()) / 2
|
needed_games = teams.size() - Turniere::Utils.previous_power_of_two(teams.size()) / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
lastPos = 0
|
lastPos = 0
|
||||||
matches = []
|
matches = []
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
while i < neededGames
|
while i < needed_games
|
||||||
match = Match(teams[2 * i], teams[( 2 * i ) + 1], 0, 0, :not_startet, i, false)
|
match = Match(teams[2 * i], teams[( 2 * i ) + 1], 0, 0, :not_startet, i, false)
|
||||||
matches.insert match
|
matches.insert match
|
||||||
i++
|
i++
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue