flutter: 添加 Position() 构造函数
This commit is contained in:
parent
ac7f2a565f
commit
2f7af08608
|
@ -79,27 +79,6 @@ class Position {
|
|||
|
||||
Move move;
|
||||
|
||||
Position.init() {
|
||||
for (var i = 0; i < _grid.length; i++) {
|
||||
_grid[i] ??= Piece.noPiece;
|
||||
}
|
||||
|
||||
for (var i = 0; i < board.length; i++) {
|
||||
board[i] ??= Piece.noPiece;
|
||||
}
|
||||
|
||||
phase = Phase.placing;
|
||||
|
||||
// Example
|
||||
//_board[sqToLoc[8]] = Piece.blackStone;
|
||||
|
||||
_recorder = MillRecorder(lastCapturedPosition: fen());
|
||||
}
|
||||
|
||||
init() {
|
||||
Position.init();
|
||||
}
|
||||
|
||||
Position.boardToGrid() {
|
||||
_grid = List<String>();
|
||||
for (int sq = 0; sq < board.length; sq++) {
|
||||
|
@ -218,6 +197,36 @@ class Position {
|
|||
return false;
|
||||
}
|
||||
|
||||
Position.init() {
|
||||
for (var i = 0; i < _grid.length; i++) {
|
||||
_grid[i] ??= Piece.noPiece;
|
||||
}
|
||||
|
||||
for (var i = 0; i < board.length; i++) {
|
||||
board[i] ??= Piece.noPiece;
|
||||
}
|
||||
|
||||
phase = Phase.placing;
|
||||
|
||||
// Example
|
||||
//_board[sqToLoc[8]] = Piece.blackStone;
|
||||
|
||||
_recorder = MillRecorder(lastCapturedPosition: fen());
|
||||
}
|
||||
|
||||
init() {
|
||||
Position.init();
|
||||
}
|
||||
|
||||
Position() {
|
||||
//const DEFAULT_RULE_NUMBER = 1;
|
||||
|
||||
//setPosition(rules[DEFAULT_RULE_NUMBER]);
|
||||
setPosition(rule); // TODO
|
||||
|
||||
score[Color.black] = score[Color.white] = score[Color.draw] = nPlayed = 0;
|
||||
}
|
||||
|
||||
void set(String fenStr) {
|
||||
/*
|
||||
A FEN string defines a particular position using only the ASCII character set.
|
||||
|
|
Loading…
Reference in New Issue