@@ -16,7 +16,8 @@ class GameState @JvmOverloads constructor(
16
16
override var board : Board = Board (),
17
17
turn : Int = 0 ,
18
18
private val undeployedRedPieces : MutableList <Piece > = parsePiecesString(Constants .STARTING_PIECES , PlayerColor .RED ),
19
- private val undeployedBluePieces : MutableList <Piece > = parsePiecesString(Constants .STARTING_PIECES , PlayerColor .BLUE )
19
+ private val undeployedBluePieces : MutableList <Piece > = parsePiecesString(Constants .STARTING_PIECES , PlayerColor .BLUE ),
20
+ override var lastMove : Move ? = null
20
21
): TwoPlayerGameState<Player>() {
21
22
22
23
@XStreamOmitField
@@ -33,8 +34,6 @@ class GameState @JvmOverloads constructor(
33
34
currentPlayerColor = currentPlayerFromTurn()
34
35
}
35
36
36
- override var lastMove: Move ? = null
37
-
38
37
val gameStats: Array <IntArray >
39
38
get() = PlayerColor .values().map { getPlayerStats(it) }.toTypedArray()
40
39
@@ -44,7 +43,7 @@ class GameState @JvmOverloads constructor(
44
43
}
45
44
46
45
/* * Copy constructor to create a new deeply copied state from the given [state]. */
47
- constructor (state: GameState ): this (state.red.clone(), state.blue.clone(), state.board.clone(), state.turn, ArrayList (state.undeployedRedPieces), ArrayList (state.undeployedBluePieces))
46
+ constructor (state: GameState ): this (state.red.clone(), state.blue.clone(), state.board.clone(), state.turn, ArrayList (state.undeployedRedPieces), ArrayList (state.undeployedBluePieces), state.lastMove )
48
47
49
48
/* * Creates a deep copy of this [GameState]. */
50
49
public override fun clone () = GameState (this )
0 commit comments