private GameBoard makeGameBoard() { string sizeOfBoard; string[] seperator = { "x" }; string[] seperateSizeOfBoard; int rowOfBoard; int colOfBoard; bool v_SizeIsValid; UI.printSign("Choosing Board Size"); do { UI.printChoseSizeOfBoardForPlayerOne(m_PlayerOne.NameOfPlayer); sizeOfBoard = System.Console.ReadLine(); exitIfQ(sizeOfBoard); v_SizeIsValid = CheckInput.IsValidBoardSize(sizeOfBoard); }while (v_SizeIsValid == false); seperateSizeOfBoard = sizeOfBoard.Split(seperator, 2, StringSplitOptions.RemoveEmptyEntries); rowOfBoard = int.Parse(seperateSizeOfBoard[0]); colOfBoard = int.Parse(seperateSizeOfBoard[1]); Ex02.ConsoleUtils.Screen.Clear(); return(new GameBoard(rowOfBoard, colOfBoard)); }
private Player playerOneLogin() { string nameOfPlayerOne; UI.printSign("Player One Login"); UI.printPlayerLogin(); nameOfPlayerOne = System.Console.ReadLine(); exitIfQ(nameOfPlayerOne); Ex02.ConsoleUtils.Screen.Clear(); return(new Player(nameOfPlayerOne, false)); }
private Player playerTwoLogin(string io_NameOfPlayerOne) { string nameOfPlayerTwo = null; bool v_WantToPlayVsCompter; UI.printSign("Player Two Login"); v_WantToPlayVsCompter = playerOneChoosingCompetition(io_NameOfPlayerOne); if (v_WantToPlayVsCompter == false) { UI.printPlayerLogin(); nameOfPlayerTwo = System.Console.ReadLine(); exitIfQ(nameOfPlayerTwo); } Ex02.ConsoleUtils.Screen.Clear(); return(new Player(nameOfPlayerTwo, v_WantToPlayVsCompter)); }
public void PlayMatchGame() { m_PlayerOne = playerOneLogin(); m_PlayerTwo = playerTwoLogin(m_PlayerOne.NameOfPlayer); UI.printSign("Welcome To Dori's World"); bool v_WantToPlayAnotherGame; do { GameBoard board = makeGameBoard(); m_PlayerOne.NewGame(null, null); m_PlayerTwo.NewGame(board.NumOfRows, board.NumOfCols); m_Ui.printBoard(board); gameRoutineAndKeepScore(board); m_Ui.announceOnTheWinner(m_PlayerOne, m_PlayerTwo); v_WantToPlayAnotherGame = UI.askForAnotherGame(m_PlayerOne.NameOfPlayer, m_PlayerTwo.NameOfPlayer); }while (v_WantToPlayAnotherGame == true); }