Skip to content

Commit 8f842a5

Browse files
committed
fix(plugin24/GameState): reveal next Segment in time
1 parent 84d76ef commit 8f842a5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

plugin/src/main/kotlin/sc/plugin2024/GameState.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ data class GameState @JvmOverloads constructor(
113113
}
114114

115115
lastMove = move
116-
board.revealSegment(board.segmentIndex(currentShip.position) + 1)
116+
board.revealSegment(board.segmentIndex(currentShip.position) + 2)
117117
advanceTurn()
118118
}
119119

plugin/src/test/kotlin/sc/plugin2024/GameStateTest.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ class GameStateTest: FunSpec({
4343
gameState.currentTeam shouldBe gameState.startTeam.opponent()
4444
}
4545

46+
test("reveals segment after move") {
47+
val state = GameState(Board(listOf(Segment.empty(), Segment.empty(CubeCoordinates(4,0)), Segment.empty(CubeCoordinates(8,0)))))
48+
val move = Move(Acceleration(5), Advance(6))
49+
var found = false
50+
state.getAllMoves().forEachRemaining { if(move == it) found = true }
51+
found shouldBe true
52+
53+
state.performMoveDirectly(move)
54+
state.board.segmentIndex(state.otherShip.position) shouldBe 1
55+
state.board.visibleSegments shouldBe 3
56+
}
57+
4658
context("points calculation") {
4759
test("at start") {
4860
gameState.ships.forAll {

0 commit comments

Comments
 (0)