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()):
4747 Array (PiranhaConstants .BOARD_LENGTH ) { FieldState .EMPTY }
4848 }
4949
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+
5060 // Place Piranhas
5161 for (index in 1 until PiranhaConstants .BOARD_LENGTH - 1 ) {
52- val size1 = random.nextInt( 2 ) + 1
62+ val size1 = randomSize()
5363 fields[0 ][index] = FieldState .from(Team .ONE , size1)
5464 fields[index][0 ] = FieldState .from(Team .TWO , size1)
5565
56- val size2 = random.nextInt( 2 ) + 1
66+ val size2 = randomSize()
5767 fields[PiranhaConstants .BOARD_LENGTH - 1 ][index] = FieldState .from(Team .ONE , size2)
5868 fields[index][PiranhaConstants .BOARD_LENGTH - 1 ] = FieldState .from(Team .TWO , size2)
5969 }
You can’t perform that action at this time.
0 commit comments