flutter: Add more print
This commit is contained in:
parent
142e32b17d
commit
bb0ec6672c
|
@ -48,6 +48,8 @@ class Settings {
|
|||
final contents = jsonEncode(_values);
|
||||
await _file.writeAsString(contents);
|
||||
|
||||
print("Settings is committed.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -64,6 +66,8 @@ class Settings {
|
|||
_file = File('${docDir.path}/$fileName');
|
||||
}
|
||||
|
||||
print("Loading $_file ...");
|
||||
|
||||
try {
|
||||
final contents = await _file.readAsString();
|
||||
_values = jsonDecode(contents);
|
||||
|
|
|
@ -121,6 +121,7 @@ class NativeEngine extends Engine {
|
|||
|
||||
Future<void> stopSearching() async {
|
||||
isActive = false;
|
||||
print("Stop current thinking...");
|
||||
await send('stop');
|
||||
}
|
||||
|
||||
|
@ -169,8 +170,6 @@ class NativeEngine extends Engine {
|
|||
posFenStr = "position fen $startPosition moves $moves";
|
||||
}
|
||||
|
||||
print("posFenStr: $posFenStr");
|
||||
|
||||
return posFenStr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,9 @@ class Game {
|
|||
};
|
||||
|
||||
bool aiIsSearching() {
|
||||
print("White is searching? ${isSearching[PieceColor.white]}\n"
|
||||
"Black is searching? ${isSearching[PieceColor.black]}\n");
|
||||
|
||||
return isSearching[PieceColor.white] == true ||
|
||||
isSearching[PieceColor.black] == true;
|
||||
}
|
||||
|
@ -105,6 +108,9 @@ class Game {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
print("White is AI? ${isAi[PieceColor.white]}\n"
|
||||
"Black is AI? ${isAi[PieceColor.black]}\n");
|
||||
}
|
||||
|
||||
select(int pos) {
|
||||
|
|
|
@ -240,6 +240,8 @@ class Position {
|
|||
" " +
|
||||
(1 + (gamePly - sideIsBlack) ~/ 2).toString();
|
||||
|
||||
print("FEN is $ss");
|
||||
|
||||
return ss;
|
||||
}
|
||||
|
||||
|
@ -388,6 +390,7 @@ class Position {
|
|||
if (st.key == i) {
|
||||
repetition++;
|
||||
if (repetition == 3) {
|
||||
print("Has game cycle.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ class _GamePageState extends State<GamePage> with RouteAware {
|
|||
|
||||
changeStatus(String? status) {
|
||||
if (!mounted) return;
|
||||
if (status != null) print("changeStatus: $status");
|
||||
|
||||
setState(() => _status = status);
|
||||
}
|
||||
|
@ -121,7 +122,7 @@ class _GamePageState extends State<GamePage> with RouteAware {
|
|||
|
||||
onBoardTap(BuildContext context, int index) {
|
||||
if (!isReady) {
|
||||
print("Not ready, skip onBoardTap.");
|
||||
print("Not ready, ignore tapping.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -136,6 +137,7 @@ class _GamePageState extends State<GamePage> with RouteAware {
|
|||
int? sq = indexToSquare[index];
|
||||
|
||||
if (sq == null) {
|
||||
print("sq is null, skip tapping.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -964,6 +966,7 @@ class _GamePageState extends State<GamePage> with RouteAware {
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
print("dipose");
|
||||
widget.engine.shutdown();
|
||||
super.dispose();
|
||||
routeObserver.unsubscribe(this);
|
||||
|
|
Loading…
Reference in New Issue