31 lines
709 B
Crystal
31 lines
709 B
Crystal
module GameOfGame
|
|
abstract class RulesSet
|
|
end
|
|
end
|
|
|
|
require "./round"
|
|
require "./ai"
|
|
|
|
module GameOfGame
|
|
# Interface
|
|
abstract class RulesSet
|
|
getter name : String
|
|
@@id_incr = 0
|
|
|
|
def initialize(name = nil)
|
|
@name = name || "RulesSet_#{self.class.to_s.split("::").last}_#{Ai.make_id}"
|
|
end
|
|
|
|
def self.make_id : String
|
|
(@@id_incr += 1).to_s.rjust(3, '0')
|
|
end
|
|
|
|
# This method is called each round for each player.
|
|
# It must return the score of the player.
|
|
# It is encouraged to keep a cache of all the players results if all is
|
|
# computed during the first examine() call of each round.
|
|
abstract def examine(round : Round, player : Ai) : Float64
|
|
end
|
|
|
|
end
|