Stack at searcher

This commit is contained in:
DMK
2021-08-20 10:55:48 +03:00
parent 186870e770
commit c1188922c8
12 changed files with 1133 additions and 439 deletions

View File

@@ -1,5 +1,4 @@
import 'dart:io';
import 'dart:developer' as dv;
import 'package:dartsunfish/index.dart';
class GameBot {
@@ -20,6 +19,7 @@ class GameBot {
// We query the user until she enters a (pseudo) legal move.
var move = <int>[];
var score = 0;
final possibleMoves = hist.last.generateMoves().toList();
while (!possibleMoves.doContains(move)) {
var pattern = RegExp(
@@ -55,16 +55,15 @@ class GameBot {
print('You won');
break;
}
// Fire up the engine to look for a move.
var _depth = 0;
var score = 0;
var start = getSeconds();
/*
*/
// Fire up the engine to look for a move.
// var _depth = 0;
var start = getSeconds();
for (var s in searcher.search(hist.last, hist.toSet())) {
_depth = s[0];
move = s[1];
score = s[2] ?? 0;
// _depth = s[0];
move = s[0];
score = s[1] ?? 0;
if (getSeconds() - start > 1) {
break;
}