flutter: 消除一些魔数

This commit is contained in:
Calcitem 2020-11-23 00:23:34 +08:00
parent 8625f1f8b7
commit 62674246a8
2 changed files with 4 additions and 4 deletions

View File

@ -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;
}

View File

@ -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");