Skip to content

Commit 28fbf4e

Browse files
committed
feat(plugin): set lastMove of GameState
1 parent 7709a2f commit 28fbf4e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

plugin/src/main/sc/plugin2022/GameState.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ data class GameState @JvmOverloads constructor(
3030
fun performMove(move: Move) {
3131
ambers[currentTeam as Team] = (ambers[currentTeam] ?: 0) +
3232
board.movePiece(move)
33+
lastMove = move
3334
turn++
3435
}
3536

plugin/src/main/sc/plugin2022/Move.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ data class Move(
1212
val delta: Vector
1313
get() = destination - start
1414

15+
fun reverse() = Move(destination, start)
16+
1517
override fun toString(): String = "Zug von $start zu $destination"
1618

1719
/** Compares the Moves based on their length ([delta]). */

0 commit comments

Comments
 (0)