private GameLogic gamePreparations() { string player1Name = ReadInput.PlayerName(), player2Name = null; GameLogic.eGameMode gameMode = ReadInput.GameMode(player1Name); if (gameMode == GameLogic.eGameMode.TwoPlayers) { player2Name = ReadInput.PlayerName(); } else { this.m_GameDifficulty = ReadInput.LevelOfDifficulty(); } ReadInput.BoardDimensions(out int boardNumOfRows, out int boardNumOfCols); this.m_CardsData.Capacity = boardNumOfRows * boardNumOfCols / 2; this.cardsDataInitialization(); if (gameMode == GameLogic.eGameMode.OnePlayer) { m_PcPlayerLogic = new GameLogic.Pc(boardNumOfRows, boardNumOfCols); } return(new GameLogic(boardNumOfRows, boardNumOfCols, gameMode, player1Name, player2Name)); }
private void playGame(GameLogic i_Game) { eNewGameRequest requestForNewGame; do { printIntroAndRules(i_Game); if (i_Game.GameMode == GameLogic.eGameMode.TwoPlayers) { do { Ex02.ConsoleUtils.Screen.Clear(); turn(i_Game); }while(i_Game.IsGameFinished() == false); } else { playVsPc(i_Game); } Ex02.ConsoleUtils.Screen.Clear(); printScoreBoard(i_Game); printCurrentBoardGame(i_Game.Data); printWinnerOrTie(i_Game); requestForNewGame = ReadInput.NewGameRequest(); if (requestForNewGame == eNewGameRequest.Yes) { ReadInput.BoardDimensions(out int boardNumOfRows, out int boardNumOfCols); this.m_CardsData.Capacity = boardNumOfRows * boardNumOfCols / 2; this.cardsDataInitialization(); if (i_Game.GameMode == GameLogic.eGameMode.OnePlayer) { this.m_GameDifficulty = ReadInput.LevelOfDifficulty(); } i_Game.ResetGame(boardNumOfRows, boardNumOfCols); m_PcPlayerLogic = new GameLogic.Pc(boardNumOfRows, boardNumOfCols); } }while(requestForNewGame == eNewGameRequest.Yes); }
public UI(int size = 0) { m_GameDifficulty = eGameDifficulty.Easy; m_CardsData = new List <char>(size); m_PcPlayerLogic = null; }