summaryrefslogtreecommitdiff
path: root/sw-common-model/src
diff options
context:
space:
mode:
Diffstat (limited to 'sw-common-model/src')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt5
1 files changed, 4 insertions, 1 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt
index f0f96971..aff8b313 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt
@@ -56,9 +56,12 @@ fun PlayerTurnInfo.getBoard(position: RelativeBoardPosition): Board = table.boar
fun PlayerTurnInfo.getNonNeighbourBoards(): List<Board> {
val nPlayers = table.boards.size
+ if (nPlayers <= 3) {
+ return emptyList()
+ }
val first = (playerIndex + 2) % nPlayers
val last = (playerIndex - 2 + nPlayers) % nPlayers
- val range = if (first < last) first..last else ((first until nPlayers) + (0..last))
+ val range = if (first <= last) first..last else ((first until nPlayers) + (0..last))
return range.map { table.boards[it] }
}
bgstack15