@@ -3,6 +3,7 @@ package sc.plugin2023
3
3
import com.thoughtworks.xstream.annotations.XStreamAlias
4
4
import sc.api.plugins.*
5
5
import sc.api.plugins.Coordinates
6
+ import sc.framework.deepCopy
6
7
import kotlin.random.Random
7
8
import sc.plugin2023.util.PenguinConstants as Constants
8
9
@@ -13,7 +14,8 @@ import sc.plugin2023.util.PenguinConstants as Constants
13
14
* @author soed
14
15
*/
15
16
@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 {
17
19
18
20
constructor (board: Board ): this (board.gameField.deepCopy())
19
21
@@ -62,7 +64,7 @@ class Board(override val gameField: MutableTwoDBoard<Field> = generateFields()):
62
64
63
65
fun getOrEmpty (key : Coordinates ? ) = key?.let { getOrNull(it) } ? : Field ()
64
66
65
- override val entries: Set <Map . Entry < Coordinates , Field >>
67
+ override val entries: Set <Positioned < Field >>
66
68
get() = filterFields { f, coordinates -> Positioned (coordinates, f) }.toSet()
67
69
68
70
override fun clone (): Board = Board (this )
@@ -91,7 +93,7 @@ class Board(override val gameField: MutableTwoDBoard<Field> = generateFields()):
91
93
}
92
94
}.let {
93
95
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 () }
95
97
}
96
98
}
97
99
}
0 commit comments