Skip to content

Commit 473eac0

Browse files
committed
Accomodate wrapped game mode
1 parent 5573aa1 commit 473eac0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

internal/battle/clairvoyant/util.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ func potentialPositions(head internal.Coord) choices {
8686

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

93-
if potential.Y >= initialState.Board.Height || potential.Y < 0 {
94-
return false
94+
if potential.Y >= initialState.Board.Height || potential.Y < 0 {
95+
return false
96+
}
9597
}
9698

9799
// check hazards

0 commit comments

Comments
 (0)