flutter: Remove legacy regret code

This commit is contained in:
Calcitem 2021-05-20 23:38:25 +08:00
parent 2ab065e3c4
commit 14a2dbc955
4 changed files with 0 additions and 85 deletions

View File

@ -284,10 +284,6 @@
"@youLose": {
"description": "You Lose!"
},
"regret": "Undo",
"@regret": {
"description": "Undo"
},
"analyze": "Analyze",
"@analyze": {
"description": "Analyze"

View File

@ -71,7 +71,6 @@
"youWin": "恭喜你赢了",
"challengeHarderLevel": "后续提升难度吗?\n提升后的难度等级将为",
"youLose": "你输了",
"regret": "悔棋",
"analyze": "分析",
"playerName": "棋手姓名",
"about": "关于",

View File

@ -139,47 +139,6 @@ class Game {
return true;
}
bool regret({moves = 2}) {
//
// Can regret only our turn
// TODO
if (_position.side != PieceColor.black) {
//Audios.playTone(Audios.invalidSoundId);
return false;
}
var regretted = false;
/// Regret 2 step
for (var i = 0; i < moves; i++) {
//
if (!_position.regret()) break;
final lastMove = _position.lastMove;
if (lastMove != null) {
//
_blurIndex = lastMove.from ?? invalidIndex;
_focusIndex = lastMove.to ?? invalidIndex;
//
} else {
//
_blurIndex = _focusIndex = invalidIndex;
}
regretted = true;
}
if (regretted) {
//Audios.playTone(Audios.regretSoundId);
return true;
}
//Audios.playTone(Audios.invalidSoundId);
return false;
}
printStat() {
double whiteWinRate = 0;
double blackWinRate = 0;

View File

@ -1062,45 +1062,6 @@ class Position {
Game.instance.setWhoIsAi(engineTypeBackup);
}
bool regret() {
// TODO
final lastMove = recorder!.removeLast();
if (lastMove == null) return false;
_grid[lastMove.from] = _grid[lastMove.to];
_grid[lastMove.to] = lastMove.removed;
board[lastMove.from] = board[lastMove.to];
board[lastMove.to] = lastMove.removed;
changeSideToMove();
final counterMarks = GameRecorder.fromCounterMarks(lastMove.counterMarks);
recorder!.halfMove = counterMarks.halfMove;
recorder!.fullMove = counterMarks.fullMove;
if (lastMove.removed != Piece.noPiece) {
//
// Find last remove position (or opening), NativeEngine need
final tempPosition = Position.clone(this);
final moves = recorder!.reverseMovesToPrevRemove();
moves.forEach((move) {
//
tempPosition._grid[move.from] = tempPosition._grid[move.to];
tempPosition._grid[move.to] = move.removed;
tempPosition._sideToMove =
PieceColor.opponent(tempPosition._sideToMove);
});
recorder!.lastPositionWithRemove = tempPosition.fen();
}
result = GameResult.pending;
return true;
}
String movesSinceLastRemove() {
int? i = 0;
String moves = "";