File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
main/kotlin/sc/plugin2022
test/kotlin/sc/plugin2022 Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -90,14 +90,15 @@ class Game(override val currentState: GameState = GameState()): AbstractGame<Pla
90
90
var cause: ScoreCause = ScoreCause .REGULAR
91
91
var reason = " "
92
92
var score: Int = Constants .LOSE_SCORE
93
-
94
- // Is the game already finished?
95
- if (winCondition?.reason == WinReason .EQUAL_SCORE )
96
- // TODO something is going wrong on draw scores
97
- score = Constants .DRAW_SCORE
98
- if (winCondition?.reason == WinReason .DIFFERING_SCORES )
99
- if (winCondition.winner == team)
100
- score = Constants .WIN_SCORE
93
+
94
+ if (winCondition != null ) {
95
+ // Game is already finished
96
+ score = if (winCondition.winner == null )
97
+ Constants .DRAW_SCORE
98
+ else {
99
+ if (winCondition.winner == team) Constants .WIN_SCORE else Constants .LOSE_SCORE
100
+ }
101
+ }
101
102
102
103
// Opponent did something wrong
103
104
if (opponent.hasViolated() && ! player.hasViolated() ||
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class GamePlayTest: WordSpec({
42
42
}
43
43
" stay paused after move" {
44
44
game.isPaused = true
45
- game.onRoundBasedAction(Move (0 y 0, 1 y 2 ))
45
+ game.onRoundBasedAction(game.currentState.possibleMoves.first( ))
46
46
game.isPaused shouldBe true
47
47
}
48
48
}
You can’t perform that action at this time.
0 commit comments