File tree Expand file tree Collapse file tree 6 files changed +8
-27
lines changed
main/kotlin/sc/plugin2025
test/kotlin/sc/plugin2025
plugin/src/test/kotlin/sc/plugin2023
sdk/src/main/server-api/sc/api/plugins
server/src/test/java/sc/server/plugins Expand file tree Collapse file tree 6 files changed +8
-27
lines changed Original file line number Diff line number Diff line change @@ -38,23 +38,6 @@ class GameStateTest: FunSpec({
38
38
// TODO
39
39
}
40
40
}
41
- context("state detection") {
42
- test("isOver") {
43
- val state = GameState ()
44
- state.round shouldBe 0
45
- state.isOver shouldBe false
46
- val state60 = GameState (turn = 58)
47
- state60.round shouldBe 29
48
- state60.isOver shouldBe false
49
- state60.turn++
50
- state60.round shouldBe 30
51
- state60.isOver shouldBe false
52
- state60.turn++
53
- state60.round shouldBe 30
54
- state60.isOver shouldBe false
55
- // state60.isOver shouldBe true
56
- }
57
- }
58
41
context("move calculation") {
59
42
context("initial placement") {
60
43
val emptyBoard = makeBoard()
Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ data class GameState @JvmOverloads constructor(
66
66
get() = currentTeamFromTurn()
67
67
68
68
override val isOver: Boolean
69
- get() = players.any { it.inGoal } && turn.mod(2 ) == 0 || round >= HuIConstants .ROUND_LIMIT
69
+ get() = players.any { it.inGoal } && turn.mod(2 ) == 0 || turn / 2 >= HuIConstants .ROUND_LIMIT
70
70
71
71
override val winCondition: WinCondition ?
72
72
get() = players.singleOrNull { it.inGoal }?.team?.let { WinCondition (it, HuIWinReason .GOAL ) }
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ class GameStateTest: FunSpec({
63
63
state.isOver shouldBe true
64
64
state.winCondition shouldBe null
65
65
}
66
+ test("round limit") {
67
+ state.turn = 59
68
+ state.isOver shouldBe false
69
+ state.turn++
70
+ state.isOver shouldBe true
71
+ }
66
72
}
67
73
test("produce nice XML ") {
68
74
Hare (Team .TWO , lastAction = EatSalad ) shouldSerializeTo """
Original file line number Diff line number Diff line change @@ -30,12 +30,9 @@ import sc.shared.WinCondition
30
30
* Teilinformationen abgefragt werden.
31
31
*/
32
32
interface IGameState : RoomMessage , PublicCloneable <IGameState > {
33
- /* * Aktuelle Zugzahl */
33
+ /* * Aktuelle Zugzahl. */
34
34
val turn: Int
35
35
36
- /* * Aktuelle Rundenzahl */
37
- val round: Int
38
-
39
36
/* * Das Team am Zug. */
40
37
val currentTeam: ITeam
41
38
Original file line number Diff line number Diff line change @@ -9,9 +9,6 @@ abstract class TwoPlayerGameState<M: IMove>(
9
9
10
10
abstract val board: IBoard
11
11
12
- override val round: Int
13
- get() = (turn+ 1 )/ 2
14
-
15
12
/* * @return das Team, das am Zug ist. */
16
13
override val currentTeam
17
14
get() = currentTeamFromTurn()
Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ data class TestGameState(
30
30
override fun teamStats (team : ITeam ) =
31
31
throw NotImplementedError (" TestGame has no teamStats" )
32
32
33
- override val round get() = turn / 2
34
-
35
33
val red = Player (Team .ONE , " Fred" )
36
34
val blue = Player (Team .TWO , " Marta" )
37
35
You can’t perform that action at this time.
0 commit comments