Skip to content

Commit

Permalink
style(plugin24): adjust Move stringification
Browse files Browse the repository at this point in the history
  • Loading branch information
xeruf committed Mar 22, 2024
1 parent 7fc0eb3 commit cc68da7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
19 changes: 2 additions & 17 deletions plugin/src/main/kotlin/sc/plugin2024/Move.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "]")

}
2 changes: 1 addition & 1 deletion plugin/src/test/kotlin/sc/plugin2024/GameResultTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class GameResultTest: WordSpec({
</score>
</entry>
</scores>
<winner team="TWO" regular="false" reason="Regelverletzung von Alice: Der Zug enthält keine Aktionen bei &apos;Move[]&apos;"/>
<winner team="TWO" regular="false" reason="Regelverletzung von Alice: Der Zug enthält keine Aktionen bei &apos;Zug[]&apos;"/>
</result>
""".trimIndent()
}
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/test/kotlin/sc/plugin2024/GameStateTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit cc68da7

Please sign in to comment.