GameOfGame/src/game_history.cr

26 lines
517 B
Crystal

require "./round"
require "./ai"
require "./rules_set"
module GameOfGame
class GameHistory
getter history : Array(Round) = Array(Round).new
getter last_round : Round?
getter total : Hash(Ai, Float64) = Hash(Ai, Float64).new
getter rules : RulesSet
def initialize(@rules)
end
def <<(round)
@history << round
@last_round = round
round.scores.each do |player, score|
@total[player] = @total.fetch(player, 0.0) + score
end
end
end
end