* DEV-1761: Clean up Ruleset interface (#115) * remove legacy ruleset types and simplify ruleset interface * remove unnecessary settings argument from Ruleset interface * decouple rules.Settings from client API and store settings as strings * DEV 1761: Add new BoardState and Point fields (#117) * add Point.TTL, Point.Value, GameState and PointState to BoardState * allow maps to access BoardState.GameState,PointState * add PreUpdateBoard and refactor snail_mode with it * fix bug where an extra turn was printed to the console * fix formatting * fix lint errors Co-authored-by: JonathanArns <jonathan.arns@googlemail.com>
19 lines
433 B
Go
19 lines
433 B
Go
package rules
|
|
|
|
var soloRulesetStages = []string{
|
|
StageGameOverSoloSnake,
|
|
StageMovementStandard,
|
|
StageStarvationStandard,
|
|
StageHazardDamageStandard,
|
|
StageFeedSnakesStandard,
|
|
StageEliminationStandard,
|
|
}
|
|
|
|
func GameOverSolo(b *BoardState, settings Settings, moves []SnakeMove) (bool, error) {
|
|
for i := 0; i < len(b.Snakes); i++ {
|
|
if b.Snakes[i].EliminatedCause == NotEliminated {
|
|
return false, nil
|
|
}
|
|
}
|
|
return true, nil
|
|
}
|