Skip to content

Commit fa1beea

Browse files
committed
fix(spider): corrected "except"-handling
1 parent 2f37eb8 commit fa1beea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

plugin/src/shared/sc/plugin2020/util/GameRuleLogic.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ object GameRuleLogic {
201201
@JvmStatic
202202
fun getAccessibleNeighboursExcept(board: Board, start: CubeCoordinates, except: CubeCoordinates) =
203203
getNeighbours(board, start).filter { neighbour ->
204-
neighbour.isEmpty && canMoveBetweenExcept(board, start, neighbour, except)
204+
neighbour.isEmpty && canMoveBetweenExcept(board, start, neighbour, except) && neighbour.coordinates != except
205205
}
206206

207207
@Throws(InvalidMoveException::class)
@@ -252,7 +252,7 @@ object GameRuleLogic {
252252
*/
253253
val found = getAccessibleNeighbours(board, move.start).any { depth1 ->
254254
getAccessibleNeighboursExcept(board, depth1, move.start).any { depth2 ->
255-
getAccessibleNeighboursExcept(board, depth2, move.start).filterNot { it.coordinates == depth1}.any { move.destination == it }
255+
getAccessibleNeighboursExcept(board, depth2, move.start).filterNot { it.coordinates == depth1 }.any { move.destination == it }
256256
}
257257
}
258258
if (found)

0 commit comments

Comments
 (0)