Example #1
0
        public Game(enPiece humanPlayer, int depth, bool bPerfectEnd)
        {
            m_bGameOver   = false;
            m_HumanPlayer = humanPlayer;
            m_depth       = depth;

            m_board   = new Board();
            m_vBoards = new LinkedList <Board>();

            m_vComputerPlayers = new Dictionary <enPiece, ComputerPlayer>();

            if (m_HumanPlayer == enPiece.Empty)
            {
                m_vComputerPlayers.Add(enPiece.White, new ComputerPlayerBalanced(enPiece.White, depth, 40, 16, 9, bPerfectEnd));
                m_vComputerPlayers.Add(enPiece.Black, new ComputerPlayerBalanced(enPiece.Black, depth, 30, 16, 9, bPerfectEnd));
            }
            else
            {
                enPiece piece = Board.FlipPiece(m_HumanPlayer);

                m_vComputerPlayers.Add(piece, new ComputerPlayerBalanced(piece, depth, 20, 1, 1, bPerfectEnd));
                //m_vComputerPlayers.Add(piece, new ComputerPlayerMasked(piece, depth, bPerfectEnd));
                //m_vComputerPlayers.Add(piece, new ComputerPlayerDeepSampler(piece));
            }
        }
Example #2
0
        private bool MakeMove(Move move, bool bSaveBoard)
        {
            if (m_board.IsMoveLegal(move))
            {
                //Save board before the move
                if (bSaveBoard)
                {
                    m_vBoards.AddLast(new Board(m_board));
                }

                //Make move
                m_board.MakeMove(move);

                //Change player
                m_current_player = Board.FlipPiece(m_current_player);

                //store gameover flag
                m_bGameOver = m_board.State.GameOver;

                //if game is not over but current player has no moves then change the current player
                if (!m_bGameOver && !m_board.HasMoves(m_current_player))
                {
                    m_current_player = Board.FlipPiece(m_current_player);
                }
                m_lastMove = move;
                return(true);
            }
            else
            {
                return(false); //no moves were made
            }
        }