From 5772ee3528689c4fd3635fad93bdce8188f58df8 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Mon, 18 Mar 2024 09:51:13 +0300 Subject: [PATCH] fix(plugin24/Board): do not allow river to reverse on the spot Fixes #99 --- plugin/src/main/kotlin/sc/plugin2024/Segment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/src/main/kotlin/sc/plugin2024/Segment.kt b/plugin/src/main/kotlin/sc/plugin2024/Segment.kt index f0e8c1736..571e6fba2 100644 --- a/plugin/src/main/kotlin/sc/plugin2024/Segment.kt +++ b/plugin/src/main/kotlin/sc/plugin2024/Segment.kt @@ -183,7 +183,7 @@ internal fun generateBoard(): Segments { val passengerTiles = shuffledIndices(PluginConstants.NUMBER_OF_SEGMENTS - 2, PluginConstants.NUMBER_OF_PASSENGERS).toArray() (2..PluginConstants.NUMBER_OF_SEGMENTS).forEach { index -> val previous = segments.last() - val direction = if(index == 2) CubeDirection.RIGHT else previous.direction.withNeighbors().filterNot { it == CubeDirection.LEFT }.random() + val direction = if(index == 2) CubeDirection.RIGHT else previous.direction.withNeighbors().filter { it != segments.takeLast(3).first().direction.opposite() }.random() // Do not allow three consecutive turns in one direction to prevent clashes val segment = generateSegment(index == PluginConstants.NUMBER_OF_SEGMENTS,