Пример #1
0
        public async Task <IEnumerable <Position> > GetIsolatedDeadPositions(Fuego fuego, GameController gameController)
        {
            var action = FuegoAction.ThatReturnsGtpResponse(() =>
            {
                var information = new AiGameInformation(gameController.Info, StoneColor.Black,
                                                        gameController.Players.Black, gameController.GameTree);
                TrueInitialize(information);
                FixHistory(information);
                // Set the player's strength
                if (_lastMaxGames != fuego.MaxGames)
                {
                    SendCommand("uct_param_player max_games " + fuego.MaxGames);
                    _lastMaxGames = fuego.MaxGames;
                }
                var result = SendCommand("final_status_list dead");
                return(result);
            });

            EnqueueAction(action);
            var response = await action.GetGtpResponseAsync();

            var positions = response.Text.Split(new[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            var mark      = new List <Position>();

            foreach (string position in positions)
            {
                mark.Add(Position.FromIgsCoordinates(position));
            }
            return(mark);
        }
Пример #2
0
        public async Task <IEnumerable <Position> > GetDeadPositions(Fuego fuego)
        {
            var action = FuegoAction.ThatReturnsGtpResponse(() =>
            {
                // Set the player's strength
                if (_lastMaxGames != fuego.MaxGames)
                {
                    SendCommand("uct_param_player max_games " + fuego.MaxGames);
                    _lastMaxGames = fuego.MaxGames;
                }
                var result = SendCommand("final_status_list dead");
                return(result);
            });

            EnqueueAction(action);
            var response = await action.GetGtpResponseAsync();

            var positions = response.Text.Split(new[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            var mark      = new List <Position>();

            foreach (string position in positions)
            {
                mark.Add(Position.FromIgsCoordinates(position));
            }
            return(mark);
        }