Implemented TestCreateNextBoardState (#15)
This commit is contained in:
parent
2d62a58c9b
commit
70a8107a6f
2 changed files with 107 additions and 1 deletions
|
|
@ -185,6 +185,11 @@ func (r *StandardRuleset) CreateNextBoardState(prevState *BoardState, moves []Sn
|
|||
}
|
||||
|
||||
func (r *StandardRuleset) moveSnakes(b *BoardState, moves []SnakeMove) error {
|
||||
for i := 0; i < len(b.Snakes); i++ {
|
||||
if len(b.Snakes[i].Body) == 0 {
|
||||
return errors.New("found snake with zero size body")
|
||||
}
|
||||
}
|
||||
if len(moves) < len(b.Snakes) {
|
||||
return errors.New("not enough snake moves")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue