Add solo gameplay ruleset.

This commit is contained in:
Brad Van Vugt 2020-05-17 14:29:30 -07:00
parent 71fc6bf503
commit fe2a415cac
2 changed files with 62 additions and 0 deletions

14
solo.go Normal file
View file

@ -0,0 +1,14 @@
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
}