From 00d900430d87ce4b8e8317a3156fbab91806ea85 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Thu, 11 Feb 2021 01:44:28 +0100 Subject: Fix board summaries (again!) --- .../src/commonMain/kotlin/org/luxons/sevenwonders/model/Moves.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sw-common-model') 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 { 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] } } -- cgit