@@ -5,6 +5,7 @@ import sc.api.plugins.Team
5
5
import sc.framework.plugins.Constants
6
6
import sc.plugin2026.util.PiranhaConstants
7
7
8
+
8
9
class GameRuleLogic private constructor() {
9
10
init {
10
11
throw java.lang.IllegalStateException (" Can't be instantiated." )
@@ -218,17 +219,17 @@ class GameRuleLogic private constructor() {
218
219
*/
219
220
fun calculateMoveDistance (board : Board , x : Int , y : Int , direction : Direction ): Int {
220
221
when (direction) {
221
- LEFT , RIGHT -> return moveDistanceHorizontal(board, x, y)
222
- UP , DOWN -> return moveDistanceVertical(board, x, y)
223
- UP_RIGHT , DOWN_LEFT -> return moveDistanceDiagonalRising(board, x, y)
224
- DOWN_RIGHT , UP_LEFT -> return moveDistanceDiagonalFalling(board, x, y)
222
+ Direction . LEFT , Direction . RIGHT -> return moveDistanceHorizontal(board, x, y)
223
+ Direction . UP , Direction . DOWN -> return moveDistanceVertical(board, x, y)
224
+ Direction . UP_RIGHT , Direction . DOWN_LEFT -> return moveDistanceDiagonalRising(board, x, y)
225
+ Direction . DOWN_RIGHT , Direction . UP_LEFT -> return moveDistanceDiagonalFalling(board, x, y)
225
226
}
226
227
return - 1
227
228
}
228
229
229
230
private fun moveDistanceHorizontal (board : Board , ignore : Int , y : Int ): Int {
230
231
var count = 0
231
- for (i in 0 until BOARD_SIZE ) {
232
+ for (i in 0 until PiranhaConstants . BOARD_LENGTH ) {
232
233
if (board.getField(i, y).getPiranha().isPresent()) {
233
234
count++
234
235
}
@@ -238,7 +239,7 @@ class GameRuleLogic private constructor() {
238
239
239
240
private fun moveDistanceVertical (board : Board , x : Int , ignore : Int ): Int {
240
241
var count = 0
241
- for (i in 0 until BOARD_SIZE ) {
242
+ for (i in 0 until PiranhaConstants . BOARD_LENGTH ) {
242
243
if (board.getField(x, i).getPiranha().isPresent()) {
243
244
count++
244
245
}
@@ -262,7 +263,7 @@ class GameRuleLogic private constructor() {
262
263
// Move up right
263
264
cX = x + 1
264
265
cY = y + 1
265
- while (cX < BOARD_SIZE && cY < BOARD_SIZE ) {
266
+ while (cX < PiranhaConstants . BOARD_LENGTH && cY < PiranhaConstants . BOARD_LENGTH ) {
266
267
if (board.getField(cX, cY).getPiranha().isPresent()) {
267
268
count++
268
269
}
@@ -277,7 +278,7 @@ class GameRuleLogic private constructor() {
277
278
var cX = x
278
279
var cY = y
279
280
// Move down left
280
- while (cX < BOARD_SIZE && cY >= 0 ) {
281
+ while (cX < PiranhaConstants . BOARD_LENGTH && cY >= 0 ) {
281
282
if (board.getField(cX, cY).getPiranha().isPresent()) {
282
283
count++
283
284
}
@@ -288,7 +289,7 @@ class GameRuleLogic private constructor() {
288
289
// Move up right
289
290
cX = x - 1
290
291
cY = y + 1
291
- while (cX >= 0 && cY < BOARD_SIZE ) {
292
+ while (cX >= 0 && cY < PiranhaConstants . BOARD_LENGTH ) {
292
293
if (board.getField(cX, cY).getPiranha().isPresent()) {
293
294
count++
294
295
}
0 commit comments