Byte-snake-engine/solo.go
John Oram f31bdff4b8
add ruleset data to the calls made by the cli (name and version) (#32)
* add ruleset data to the cli (name and version)
* remove double ruleset tracking with royale mode
2021-07-02 20:00:19 -07:00

16 lines
378 B
Go

package rules
type SoloRuleset struct {
StandardRuleset
}
func (r *SoloRuleset) IsGameOver(b *BoardState) (bool, error) {
for i := 0; i < len(b.Snakes); i++ {
if b.Snakes[i].EliminatedCause == NotEliminated {
return false, nil
}
}
return true, nil
}
func (r *SoloRuleset) Name() string { return "solo" }
func (r *SoloRuleset) Version() string { return "1.0.0" }