summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoffrey-bion <joffrey.bion@gmail.com>2021-02-11 01:44:28 +0100
committerjoffrey-bion <joffrey.bion@gmail.com>2021-02-11 01:44:28 +0100
commit00d900430d87ce4b8e8317a3156fbab91806ea85 (patch)
treecd4596baed36131265548117dc27852d293ff2a5
parentFix closed issues workflow (diff)
downloadseven-wonders-00d900430d87ce4b8e8317a3156fbab91806ea85.tar.gz
seven-wonders-00d900430d87ce4b8e8317a3156fbab91806ea85.tar.bz2
seven-wonders-00d900430d87ce4b8e8317a3156fbab91806ea85.zip
Fix board summaries (again!)
-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