Skip to content

Commit 7af2952

Browse files
committed
fix(plugin24): representation adjustments for generic gui
1 parent 2924e05 commit 7af2952

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

plugin/src/main/kotlin/sc/plugin2024/Field.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ sealed class Field: IField<Field> {
1111
get() = true
1212
override fun clone() = this
1313

14+
override fun toString() = javaClass.simpleName
15+
1416
val letter: Char
1517
get() = javaClass.simpleName.first()
1618

@@ -34,6 +36,7 @@ sealed class Field: IField<Field> {
3436
override val isEmpty
3537
get() = false
3638
override fun clone() = PASSENGER(direction, passenger)
39+
override fun toString() = "PASSENGER${direction.ordinal}${passenger}"
3740
}
3841

3942
/** Ein Zielfeld */

plugin/src/main/kotlin/sc/plugin2024/GameState.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ data class GameState @JvmOverloads constructor(
4646
override var lastMove: Move? = null,
4747
): TwoPlayerGameState<Move>(currentTeam) {
4848

49-
init {
50-
println(this.longString())
51-
}
52-
5349
val currentShip: Ship
5450
get() = ships[currentTeam.index]
5551

@@ -69,8 +65,6 @@ data class GameState @JvmOverloads constructor(
6965
it.speed * 10 +
7066
it.coal
7167
}!!.team
72-
// TODO or something like this?
73-
// Team.values().maxByOrNull { getPointsForTeam(it) }
7468

7569
fun calculatePoints(ship: Ship) =
7670
board.segmentIndex(ship.position).let { segmentIndex ->
@@ -136,7 +130,6 @@ data class GameState @JvmOverloads constructor(
136130
override fun getAllMoves(): Iterator<IMove> =
137131
getPossibleMoves().iterator()
138132

139-
// TODO this should be a Stream
140133
/** Possible simple Moves (accelerate+turn+move) using at most the given coal amount. */
141134
fun getPossibleMoves(maxCoal: Int = currentShip.coal): List<IMove> =
142135
// SANDBANK checkSandbankAdvances(currentShip)?.map { Move(it) } ?:
@@ -337,7 +330,7 @@ data class GameState @JvmOverloads constructor(
337330

338331
override fun getPointsForTeam(team: ITeam): IntArray =
339332
ships[team.index].let { ship ->
340-
intArrayOf(ship.points, ship.speed, ship.coal)
333+
intArrayOf(ship.points, ship.coal * 2)
341334
}
342335

343336
override fun clone(): GameState = copy(board = board.clone(), ships = ships.clone())

0 commit comments

Comments
 (0)