flutter: 删除或修改部分打印

This commit is contained in:
Calcitem 2020-12-06 19:07:24 +08:00
parent e8dbe2e2d3
commit fc429a9b47
4 changed files with 24 additions and 24 deletions

View File

@ -264,7 +264,7 @@ class Position {
// step counter // step counter
//ss += '${recorder?.halfMove ?? 0} ${recorder?.fullMove ?? 0}'; //ss += '${recorder?.halfMove ?? 0} ${recorder?.fullMove ?? 0}';
print("fen = " + ss); //print("fen = " + ss);
return ss; return ss;
} }
@ -306,7 +306,7 @@ class Position {
*/ */
bool ret = false; bool ret = false;
print("position: command = $move"); //print("doMove $move");
if (move.length > "Player".length && if (move.length > "Player".length &&
move.substring(0, "Player".length - 1) == "Player") { move.substring(0, "Player".length - 1) == "Player") {
@ -578,7 +578,7 @@ class Position {
// not in moveTable // not in moveTable
if (md == moveDirectionNumber) { if (md == moveDirectionNumber) {
print("putPiece: [$s] is not in [$currentSquare]'s moveTable"); print("putPiece: [$s] is not in [$currentSquare]'s move table.");
return false; return false;
} }
} }
@ -742,7 +742,7 @@ class Position {
} }
bool checkGameOverCondition() { bool checkGameOverCondition() {
print("Checking game over condition ..."); //print("Is game over?");
if (phase == Phase.ready || phase == Phase.gameOver) { if (phase == Phase.ready || phase == Phase.gameOver) {
return true; return true;
@ -752,7 +752,7 @@ class Position {
winner = Color.draw; winner = Color.draw;
phase = Phase.gameOver; phase = Phase.gameOver;
gameOverReason = GameOverReason.drawReasonRule50; gameOverReason = GameOverReason.drawReasonRule50;
print("Game over, draw, because of $gameOverReason"); print("Game over, draw, because of $gameOverReason.");
return true; return true;
} }
@ -768,7 +768,7 @@ class Position {
} }
bool isNoWay = isAllSurrounded(); bool isNoWay = isAllSurrounded();
print("phase = $phase, action = $action, isAllSurrounded = $isNoWay"); //print("phase = $phase, action = $action, isAllSurrounded = $isNoWay");
if (phase == Phase.moving && action == Act.select && isNoWay) { if (phase == Phase.moving && action == Act.select && isNoWay) {
if (rule.isLoseButNotChangeSideWhenNoWay) { if (rule.isLoseButNotChangeSideWhenNoWay) {
setGameOver( setGameOver(
@ -776,12 +776,12 @@ class Position {
return true; return true;
} else { } else {
changeSideToMove(); // TODO: Need? changeSideToMove(); // TODO: Need?
print("Game is not over"); //print("Game is not over");
return false; return false;
} }
} }
print("Game is NOT over"); //print("Game is NOT over");
return false; return false;
} }
@ -1417,14 +1417,14 @@ class Position {
// Full // Full
if (pieceCountOnBoard[Color.black] + pieceCountOnBoard[Color.white] >= if (pieceCountOnBoard[Color.black] + pieceCountOnBoard[Color.white] >=
rankNumber * fileNumber) { rankNumber * fileNumber) {
print("Board is full."); //print("Board is full.");
return true; return true;
} }
// Can fly // Can fly
if (pieceCountOnBoard[sideToMove()] <= rule.nPiecesAtLeast && if (pieceCountOnBoard[sideToMove()] <= rule.nPiecesAtLeast &&
rule.allowFlyWhenRemainThreePieces) { rule.allowFlyWhenRemainThreePieces) {
print("Can fly."); //print("Can fly.");
return false; return false;
} }
@ -1443,7 +1443,7 @@ class Position {
} }
} }
print("No way."); //print("No way.");
return true; return true;
} }
@ -1500,7 +1500,7 @@ class Position {
String moves = ""; String moves = "";
int posAfterLastRemove = 0; int posAfterLastRemove = 0;
print("recorder.movesCount = ${recorder.movesCount}"); //print("recorder.movesCount = ${recorder.movesCount}");
for (i = recorder.movesCount - 1; i >= 0; i--) { for (i = recorder.movesCount - 1; i >= 0; i--) {
//if (recorder.moveAt(i).type == MoveType.remove) break; //if (recorder.moveAt(i).type == MoveType.remove) break;
@ -1511,17 +1511,17 @@ class Position {
posAfterLastRemove = i + 1; posAfterLastRemove = i + 1;
} }
print("[movesSinceLastRemove] posAfterLastRemove = $posAfterLastRemove"); //print("[movesSinceLastRemove] posAfterLastRemove = $posAfterLastRemove");
for (int i = posAfterLastRemove; i < recorder.movesCount; i++) { for (int i = posAfterLastRemove; i < recorder.movesCount; i++) {
moves += " ${recorder.moveAt(i).move}"; moves += " ${recorder.moveAt(i).move}";
} }
print("moves = $moves"); //print("moves = $moves");
var idx = moves.indexOf('-('); var idx = moves.indexOf('-(');
if (idx != -1) { if (idx != -1) {
print("moves[$idx] is -("); //print("moves[$idx] is -(");
assert(false); assert(false);
} }
@ -1535,7 +1535,7 @@ class Position {
void changeSideToMove() { void changeSideToMove() {
them = _sideToMove; them = _sideToMove;
_sideToMove = Color.opponent(_sideToMove); _sideToMove = Color.opponent(_sideToMove);
print("Change sideToMove to $_sideToMove"); print("$_sideToMove to move.");
} }
get halfMove => recorder.halfMove; get halfMove => recorder.halfMove;

View File

@ -138,7 +138,7 @@ class PiecesPainter extends PiecesBasePainter {
canvas.drawCircle(pps.pos, pieceInnerRadius, paint); canvas.drawCircle(pps.pos, pieceInnerRadius, paint);
break; break;
case Piece.ban: case Piece.ban:
print("pps.piece is Ban"); //print("pps.piece is Ban");
break; break;
default: default:
assert(false); assert(false);

View File

@ -80,13 +80,13 @@ class Board extends StatelessWidget {
final column = (dx - padding) ~/ squareWidth; final column = (dx - padding) ~/ squareWidth;
if (column < 0 || column > 6) { if (column < 0 || column > 6) {
print("Tap on column $column skip"); print("Tap on column $column (ignored).");
return; return;
} }
final row = (dy - padding - digitsHeight) ~/ squareWidth; final row = (dy - padding - digitsHeight) ~/ squareWidth;
if (row < 0 || row > 6) { if (row < 0 || row > 6) {
print("Tap on row $row skip"); print("Tap on row $row (ignored).");
return; return;
} }

View File

@ -54,7 +54,7 @@ class _GamePageState extends State<GamePage> {
@override @override
void initState() { void initState() {
print("engineType = ${widget.engineType}"); print("Engine type: ${widget.engineType}");
Game.shared.setWhoIsAi(widget.engineType); Game.shared.setWhoIsAi(widget.engineType);
@ -65,7 +65,7 @@ class _GamePageState extends State<GamePage> {
changeStatus(String status) { changeStatus(String status) {
if (context == null) { if (context == null) {
print("[changeStatus] context == null, return"); //print("[changeStatus] context == null, return");
return; return;
} }
@ -74,7 +74,7 @@ class _GamePageState extends State<GamePage> {
void showTips() { void showTips() {
if (context == null) { if (context == null) {
print("[showTips] context == null, return"); //print("[showTips] context == null, return");
return; return;
} }
@ -105,7 +105,7 @@ class _GamePageState extends State<GamePage> {
int sq = indexToSquare[index]; int sq = indexToSquare[index];
if (sq == null) { if (sq == null) {
print("putPiece skip index: $index"); //print("putPiece skip index: $index");
return; return;
} }
@ -251,7 +251,7 @@ class _GamePageState extends State<GamePage> {
changeStatus(S.of(context).gameStarted); changeStatus(S.of(context).gameStarted);
if (Game.shared.isAiToMove()) { if (Game.shared.isAiToMove()) {
print("New Game: AI's turn."); print("New game, AI to move.");
engineToGo(); engineToGo();
} }
} }