File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
plugin2026/src/main/kotlin/sc/plugin2026 Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -47,13 +47,23 @@ class Board(gameField: MutableTwoDBoard<FieldState> = randomFields()):
47
47
Array (PiranhaConstants .BOARD_LENGTH ) { FieldState .EMPTY }
48
48
}
49
49
50
+ fun randomSize (): Int {
51
+ // 4:3:2
52
+ val int = random.nextInt(9 )
53
+ return when {
54
+ int < 4 -> 1
55
+ int < 7 -> 2
56
+ else -> 3
57
+ }
58
+ }
59
+
50
60
// Place Piranhas
51
61
for (index in 1 until PiranhaConstants .BOARD_LENGTH - 1 ) {
52
- val size1 = random.nextInt( 2 ) + 1
62
+ val size1 = randomSize()
53
63
fields[0 ][index] = FieldState .from(Team .ONE , size1)
54
64
fields[index][0 ] = FieldState .from(Team .TWO , size1)
55
65
56
- val size2 = random.nextInt( 2 ) + 1
66
+ val size2 = randomSize()
57
67
fields[PiranhaConstants .BOARD_LENGTH - 1 ][index] = FieldState .from(Team .ONE , size2)
58
68
fields[index][PiranhaConstants .BOARD_LENGTH - 1 ] = FieldState .from(Team .TWO , size2)
59
69
}
You can’t perform that action at this time.
0 commit comments