flutter: 消除一些魔数
This commit is contained in:
parent
8625f1f8b7
commit
62674246a8
|
@ -186,9 +186,8 @@ class Position {
|
|||
var ss = '';
|
||||
|
||||
// Piece placement data
|
||||
for (var file = 1; file <= 3; file++) {
|
||||
for (var rank = 1; rank <= 8; rank++) {
|
||||
//
|
||||
for (var file = 1; file <= fileNumber; file++) {
|
||||
for (var rank = 1; rank <= rankNumber; rank++) {
|
||||
final piece = pieceOnGrid(squareToIndex[makeSquare(file, rank)]);
|
||||
ss += piece;
|
||||
}
|
||||
|
@ -327,6 +326,7 @@ class Position {
|
|||
phase = Phase.gameOver;
|
||||
winner = Color.draw;
|
||||
score[Color.draw]++;
|
||||
// TODO
|
||||
gameOverReason = GameOverReason.drawReasonThreefoldRepetition;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ enum Rank { rank_1, rank_2, rank_3, rank_4, rank_5, rank_6, rank_7, rank_8 }
|
|||
const rankNumber = 8;
|
||||
|
||||
bool isOk(int sq) {
|
||||
bool ret = (sq == 0 || (sq >= 8 && sq <= 31));
|
||||
bool ret = (sq == 0 || (sq >= sqBegin && sq < sqEnd));
|
||||
|
||||
if (ret == false) {
|
||||
print("$sq is not OK");
|
||||
|
|
Loading…
Reference in New Issue