Skip to content

Commit

Permalink
Accomodate wrapped game mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bethanyj28 committed Feb 10, 2022
1 parent 5573aa1 commit 473eac0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/battle/clairvoyant/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ func potentialPositions(head internal.Coord) choices {

func checkPossible(initialState internal.GameState, grid matrix, potential internal.Coord, otherSnakeLength map[string]int32) bool {
// check walls
if potential.X >= initialState.Board.Width || potential.X < 0 {
return false
}
if initialState.Game.Ruleset.Name != "wrapped" {
if potential.X >= initialState.Board.Width || potential.X < 0 {
return false
}

if potential.Y >= initialState.Board.Height || potential.Y < 0 {
return false
if potential.Y >= initialState.Board.Height || potential.Y < 0 {
return false
}
}

// check hazards
Expand Down

0 comments on commit 473eac0

Please sign in to comment.