Skip to content

Commit 6cd5074

Browse files
committed
feat(plugin26): create rudimentary GameState
1 parent 876e993 commit 6cd5074

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

plugin2025/src/main/kotlin/sc/plugin2025/GameState.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import kotlin.math.sqrt
1818
/**
1919
* The GameState class represents the current state of the game.
2020
*
21-
* It holds all the information about the current round, which is used
22-
* to calculate the next move.
21+
* It holds all the information about the current round,
22+
* to provide all information needed to make the next move.
2323
*
2424
* @property board The current game board.
2525
* @property turn The number of turns already made in the game.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package sc.plugin2019
2+
3+
import com.thoughtworks.xstream.annotations.XStreamAlias
4+
import com.thoughtworks.xstream.annotations.XStreamAsAttribute
5+
import sc.api.plugins.Team
6+
import sc.api.plugins.TwoPlayerGameState
7+
import sc.plugin2026.Board
8+
import sc.plugin2026.Move
9+
10+
/**
11+
* The GameState class represents the current state of the game.
12+
*
13+
* It holds all the information about the current round,
14+
* to provide all information needed to make the next move.
15+
*
16+
* @property board The current game board.
17+
* @property turn The number of turns already made in the game.
18+
* @property lastMove The last move made in the game.
19+
*/
20+
@XStreamAlias(value = "state")
21+
data class GameState @JvmOverloads constructor(
22+
/** Das aktuelle Spielfeld. */
23+
override val board: Board = Board(),
24+
/** Die Anzahl an bereits getätigten Zügen. */
25+
@XStreamAsAttribute override var turn: Int = 0,
26+
/** Der zuletzt gespielte Zug. */
27+
override var lastMove: Move? = null,
28+
): TwoPlayerGameState<Move>(Team.ONE) {
29+
30+
override fun getPointsForTeam(team: ITeam): IntArray =
31+
GameRuleLogic.greatestSwarmSize(board, playerColor) // TODO important
32+
33+
// TODO implement missing methods - check previous years
34+
35+
}

0 commit comments

Comments
 (0)