Exemple #1
0
        public void DoIteration(int i_X, int i_Y)
        {
            bool playerCanMove = false;

            if (!m_CurrentPlayer.IsComputer)
            {
                m_CurrentGame.Move(i_X, i_Y, m_CurrentPlayer);

                switchPlayer(m_CurrentPlayer);
                playerCanMove = updatePossibleMoves();
            }

            if (m_CurrentPlayer.IsComputer && playerCanMove)
            {
                m_CurrentGame.DoComputerMove(m_CurrentPlayer);
                switchPlayer(m_CurrentPlayer);
                playerCanMove = updatePossibleMoves();
            }

            if (!playerCanMove)
            {
                switchPlayer(m_CurrentPlayer);
                playerCanMove = updatePossibleMoves();

                if (!playerCanMove)
                {
                    showEndOfGameMessage();
                }
            }
        }