@@ -3,6 +3,7 @@ package sc.plugin2023
33import com.thoughtworks.xstream.annotations.XStreamAlias
44import sc.api.plugins.*
55import sc.api.plugins.Coordinates
6+ import sc.framework.deepCopy
67import kotlin.random.Random
78import sc.plugin2023.util.PenguinConstants as Constants
89
@@ -13,7 +14,8 @@ import sc.plugin2023.util.PenguinConstants as Constants
1314 * @author soed
1415 */
1516@XStreamAlias(value = " board" )
16- class Board (override val gameField : MutableTwoDBoard <Field > = generateFields()): RectangularBoard<Field>(gameField) {
17+ class Board (override val gameField : MutableTwoDBoard <Field > = generateFields()):
18+ RectangularBoard <Field >(gameField), IBoard {
1719
1820 constructor (board: Board ): this (board.gameField.deepCopy())
1921
@@ -62,7 +64,7 @@ class Board(override val gameField: MutableTwoDBoard<Field> = generateFields()):
6264
6365 fun getOrEmpty (key : Coordinates ? ) = key?.let { getOrNull(it) } ? : Field ()
6466
65- override val entries: Set <Map . Entry < Coordinates , Field >>
67+ override val entries: Set <Positioned < Field >>
6668 get() = filterFields { f, coordinates -> Positioned (coordinates, f) }.toSet()
6769
6870 override fun clone (): Board = Board (this )
@@ -91,7 +93,7 @@ class Board(override val gameField: MutableTwoDBoard<Field> = generateFields()):
9193 }
9294 }.let {
9395 it + it.reversedArray().map { list ->
94- Array (Constants .BOARD_SIZE ) { index -> list[Constants .BOARD_SIZE - index - 1 ].clone () }
96+ Array (Constants .BOARD_SIZE ) { index -> list[Constants .BOARD_SIZE - index - 1 ].deepCopy () }
9597 }
9698 }
9799 }
0 commit comments