Ejemplo n.º 1
0
        private void UserTurn(ref Player io_User, ref List <CellMatrix> io_UserPossibleMove)
        {
            int  row = 0, col = 0;
            bool isInputOK = false;

            PrintCurrentScreen();
            if (r_GameMode == k_GameAgainstFriend)
            {
                UI.ShowWhoIsTurn(io_User);
            }

            UI.GetMoveFromUser(ref row, ref col, m_Board);

            if (row == k_QuitProgram && col == k_QuitProgram)
            {
                UI.QuitGame();
                Environment.Exit(0);
            }

            if (io_UserPossibleMove.Count != k_NoPossibleMoves)
            {
                do
                {
                    if (CheckIfMoveIsInList(io_UserPossibleMove, row, col) == true)
                    {
                        m_Board.SetCellValue(io_User.Symbol, row, col);
                        CheckAndUpdateBoard(row, col, io_User.Symbol, true);
                        isInputOK = true;
                    }
                    else
                    {
                        UI.SelectSquareAgain();
                        UI.GetMoveFromUser(ref row, ref col, m_Board);
                    }
                }while (!isInputOK);
            }
            else
            {
                UI.TurnPassed();
            }
        }