diff --git a/src/ui/flutter_app/lib/engine/analyze.dart b/src/ui/flutter_app/lib/engine/analyze.dart deleted file mode 100644 index 4f394ac3..00000000 --- a/src/ui/flutter_app/lib/engine/analyze.dart +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of Sanmill. - Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file) - - Sanmill is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Sanmill is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -class AnalyzeItem { - String move, moveName; - int score; - double winRate; - - AnalyzeItem({this.move, this.score, this.winRate}); - - @override - String toString() { - return '{move: ${moveName ?? move}, score: $score, winRate: $winRate}'; - } -} - -class AnalyzeFetcher { - static List fetch(String response, {limit = 5}) { - final segments = response.split('|'); - - List result = []; - - final regExp = RegExp(r'move:(.{4}).+score:(\-?\d+).+winRate:(\d+.?\d*)'); - - for (var segment in segments) { - final match = regExp.firstMatch(segment); - - if (match == null) break; - - final move = match.group(1); - final score = int.parse(match.group(2)); - final winRate = double.parse(match.group(3)); - - result.add(AnalyzeItem(move: move, score: score, winRate: winRate)); - if (result.length == limit) break; - } - - return result; - } -} diff --git a/src/ui/flutter_app/lib/widgets/game_page.dart b/src/ui/flutter_app/lib/widgets/game_page.dart index d0502878..31bd6a90 100644 --- a/src/ui/flutter_app/lib/widgets/game_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_page.dart @@ -19,7 +19,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:sanmill/common/config.dart'; -import 'package:sanmill/engine/analyze.dart'; import 'package:sanmill/engine/engine.dart'; import 'package:sanmill/engine/native_engine.dart'; import 'package:sanmill/generated/l10n.dart'; @@ -283,37 +282,6 @@ class _GamePageState extends State with RouteAware { setState(() => _searching = true); } - showAnalyzeItems( - BuildContext context, { - String title, - List items, - Function(AnalyzeItem item) callback, - }) { - final List children = []; - - for (var item in items) { - children.add( - ListTile( - title: Text(item.moveName, style: TextStyle(fontSize: 18)), - subtitle: Text(S.of(context).winRate + ": ${item.winRate}%"), - trailing: Text(S.of(context).score + ": ${item.score}'"), - onTap: () => callback(item), - ), - ); - children.add(Divider()); - } - - children.insert(0, SizedBox(height: 10)); - children.add(SizedBox(height: 56)); - - showModalBottomSheet( - context: context, - builder: (BuildContext context) => SingleChildScrollView( - child: Column(mainAxisSize: MainAxisSize.min, children: children), - ), - ); - } - String getGameOverReasonString(GameOverReason reason, String winner) { String loseReasonStr; //String winnerStr =