Add solo gameplay ruleset.
This commit is contained in:
parent
71fc6bf503
commit
fe2a415cac
2 changed files with 62 additions and 0 deletions
14
solo.go
Normal file
14
solo.go
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue