예제 #1
0
        public void RunDynamicTreeSplittingBenchmark()
        {
            var result = _wrapper2.Run(_practiceBoard2, _node2, sbyte.MinValue, sbyte.MaxValue, 10, _cts.Token);

            _node2.Children = null;
            GC.Collect();
        }
예제 #2
0
        public void RunSerialGameTreeSearchBenchmark()
        {
            var result = _wrapper1.Run(_practiceBoard1, _node1, sbyte.MinValue, sbyte.MaxValue, 10, _cts.Token);

            _node1.Children = null;
            GC.Collect();
        }
예제 #3
0
        public Task MakeMove(IGame game, CancellationToken ct)
        {
            var latestMove = game.LatestMove;

            var practiceBoard = game.Board.ToMinified();

            var root = new GameNode(latestMove, game.Board, practiceBoard.ActivePlayer);

            root = _treeManager.GoDownToNode(root);

            // add registration to abort threads
            var(plannedMoves, maxPly) =
                _search.Run(practiceBoard, root, sbyte.MinValue, sbyte.MaxValue, int.MaxValue, ct);

            Ply = maxPly;
            StopThinking(game, plannedMoves);
            return(Task.CompletedTask);
        }
        public void DynamicDeepeningSequentialTest_1()
        {
            var sourceBoardStr = new[]
            {
                "B___",
                "____",
                "__w_",
                "____"
            };
            var sourceBoard = new BoardMock(sourceBoardStr, 4, false);

            var root = new GameNode();

            var practiceBoard = sourceBoard.ToMinified();

            var(result, maxPly) = _wrapper.Run(practiceBoard, root, sbyte.MinValue, sbyte.MaxValue, 2, _cts.Token);
            var bestMove = result.Peek().Move;

            bestMove.From.Should().BeEquivalentTo(new Cell(2, 2));
            bestMove.To.Should().BeEquivalentTo(new Cell(3, 1));
        }