@@ -138,7 +138,7 @@ object GameRuleLogic {
138138 throw InvalidMoveException (" Field $it is out of bounds" , move)
139139 }
140140 // Checks if a part of the piece is obstructed
141- if (isObstructed(board, it))
141+ if (board. isObstructed(it))
142142 throw InvalidMoveException (" Field $it already belongs to ${board[it].content} " , move)
143143 // Checks if a part of the piece would border on another piece of same color
144144 if (bordersOnColor(board, it, move.color))
@@ -163,11 +163,6 @@ object GameRuleLogic {
163163 throw InvalidMoveException (" Can't Skip on first round" , SkipMove (gameState.currentColor))
164164 }
165165
166- /* * Check if the given [position] is already obstructed by another piece. */
167- @JvmStatic
168- private fun isObstructed (board : Board , position : Coordinates ): Boolean =
169- board[position].content != FieldContent .EMPTY
170-
171166 /* * Check if the given [position] already borders on another piece of same [color]. */
172167 @JvmStatic
173168 private fun bordersOnColor (board : Board , position : Coordinates , color : Color ): Boolean = listOf (
@@ -195,7 +190,7 @@ object GameRuleLogic {
195190 /* * Return true if the given [Coordinates] are a corner. */
196191 @JvmStatic
197192 private fun isOnCorner (position : Coordinates ): Boolean =
198- Corner .asSet ().contains( position)
193+ Corner .values ().any { it. position == position }
199194
200195 /* * Gib zurück, ob sich der [GameState] noch in der ersten Runde befindet. */
201196 @JvmStatic
0 commit comments