Exemplo n.º 1
0
        private Location GetBestMove(MinimaxResult playResult)
        {
            Location result = playResult.Move;

            int moveScore = playResult.Score;

            this.IsGameWon = MoveScoreConverter.IsWin(moveScore) && MoveScoreConverter.WinDepth(moveScore) == 1;

            Occupied opponent   = (!this.hexGame.PlayerX).ToPlayer();
            bool     losingMove = MoveScoreConverter.Winner(playResult.Score) == opponent;

            if (losingMove)
            {
                Location losingLocation = this.MakeLosingMove();
                if (losingLocation != Location.Null)
                {
                    result = losingLocation;
                }
            }

            return(result);
        }