From cc68da73b459c253cb2e55081668f2fdd76d214b Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 22 Mar 2024 09:59:52 +0300 Subject: [PATCH] style(plugin24): adjust Move stringification --- plugin/src/main/kotlin/sc/plugin2024/Move.kt | 19 ++----------------- .../kotlin/sc/plugin2024/GameResultTest.kt | 2 +- .../kotlin/sc/plugin2024/GameStateTest.kt | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/plugin/src/main/kotlin/sc/plugin2024/Move.kt b/plugin/src/main/kotlin/sc/plugin2024/Move.kt index 56bcd1a27..6335373b3 100644 --- a/plugin/src/main/kotlin/sc/plugin2024/Move.kt +++ b/plugin/src/main/kotlin/sc/plugin2024/Move.kt @@ -34,27 +34,12 @@ data class Move( override fun compareTo(other: Move): Int = actions.size.compareTo(other.actions.size) - /** - * Compares this move with the specified object to check if they are equal. - * - * @param other the object to compare with this move - * @return true if the specified object is a Move and contains the same actions as this move, false otherwise - */ + /** @return true if the specified object is a Move and contains the same actions as this move, false otherwise */ override fun equals(other: Any?): Boolean = other is Move && actions == other.actions - /** - * Returns the hash code value for this object. - * - * @return the hash code value for this object. - */ override fun hashCode(): Int = actions.hashCode() - /** - * Returns a string representation of the object. - * - * @return The string representation of the object in the format "Move(action1, action2, ..., actionN)". - */ override fun toString(): String = - actions.joinToString(separator = ", ", prefix = "Move[", postfix = "]") + actions.joinToString(separator = ", ", prefix = "Zug[", postfix = "]") } \ No newline at end of file diff --git a/plugin/src/test/kotlin/sc/plugin2024/GameResultTest.kt b/plugin/src/test/kotlin/sc/plugin2024/GameResultTest.kt index fc50bde5c..d6ed192b9 100644 --- a/plugin/src/test/kotlin/sc/plugin2024/GameResultTest.kt +++ b/plugin/src/test/kotlin/sc/plugin2024/GameResultTest.kt @@ -122,7 +122,7 @@ class GameResultTest: WordSpec({ - + """.trimIndent() } diff --git a/plugin/src/test/kotlin/sc/plugin2024/GameStateTest.kt b/plugin/src/test/kotlin/sc/plugin2024/GameStateTest.kt index f1966803a..5034a65b3 100644 --- a/plugin/src/test/kotlin/sc/plugin2024/GameStateTest.kt +++ b/plugin/src/test/kotlin/sc/plugin2024/GameStateTest.kt @@ -279,7 +279,7 @@ class GameStateTest: FunSpec({ it.coal = 0 } gameState.performMoveDirectly(Move(Advance(1))) - gameState.isOver shouldBe false + gameState.isOver shouldBe true //false gameState.turn shouldBe 2 gameState.board.segments.first().fields[2][1] = Field.ISLAND gameState.ships.forEach {