30 lines
683 B
Dart
30 lines
683 B
Dart
|
import '../board.dart';
|
||
|
import 'special_stone.dart';
|
||
|
import 'stone_location.dart';
|
||
|
|
||
|
class PentaSpecialStone extends SpecialStone {
|
||
|
PentaSpecialStone(super.board);
|
||
|
|
||
|
@override
|
||
|
int getSpecialStoneNumber() {
|
||
|
return 5;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
void performSpecialStoneAction() {
|
||
|
StoneLocation sl = StoneLocation(row: -1, column: -1);
|
||
|
for (int i = 0; i < Board.boardSize; ++i) {
|
||
|
for (int j = 0; j < Board.boardSize; ++j) {
|
||
|
sl.row = i;
|
||
|
sl.column = j;
|
||
|
if (this == board.getStone(sl)) {
|
||
|
continue;
|
||
|
}
|
||
|
if (board.getStone(sl)?.getStoneColor() == getStoneColor()) {
|
||
|
board.removeStone(sl);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|