28 lines
677 B
Dart
28 lines
677 B
Dart
|
import '../Board.dart';
|
||
|
import 'SpecialStone.dart';
|
||
|
import 'StoneLocation.dart';
|
||
|
|
||
|
class PentaSpecialStone extends SpecialStone {
|
||
|
PentaSpecialStone(Board board) : super(board);
|
||
|
|
||
|
int getSpecialStoneNumber() {
|
||
|
return 5;
|
||
|
}
|
||
|
|
||
|
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() == this.getStoneColor()) {
|
||
|
board.removeStone(sl);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|