Skip to content

Commit

Permalink
fix(plugin24/Board): do not allow river to reverse on the spot
Browse files Browse the repository at this point in the history
Fixes #99
  • Loading branch information
xeruf committed Mar 18, 2024
1 parent 1cc2805 commit 5772ee3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugin/src/main/kotlin/sc/plugin2024/Segment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5772ee3

Please sign in to comment.