Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 private void buttonPlayHumanVsHuman_Click(object i_Sender, EventArgs i_E)
 {
     // this method represents an event for HumanVsHuman button was clicked.
     m_GameMode         = GameLogic.eGameMode.HumanVsHuman;
     m_FormClosedByUser = false;
     Close();
 }
Exemplo n.º 3
0
 public FormOthello(GameLogic i_GameLogic, Board.eBoardSize i_BoardSize, GameLogic.eGameMode i_GameMode)
 {
     // formOthello c'tor
     m_GameLogic = i_GameLogic;
     InitializeComponent();
     configureGameSettings(i_BoardSize, i_GameMode);
     createGameBoard();
     Initialize();
     adjustWindowSize(i_BoardSize);
     this.Icon = Ex05_Othello.UI.Resource1.icon;
 }
Exemplo n.º 4
0
        private Player getOpponent(out GameLogic.eGameMode o_GameMode)
        {
            Player opponent;

            o_GameMode = getGameModeFromPlayer();
            if (o_GameMode == GameLogic.eGameMode.PlayerVsPlayer)
            {
                opponent = new Player(getPlayerName("Please enter second player name: "), Player.ePlayerType.Human);
            }
            else
            {
                opponent = new Player("Computer", Player.ePlayerType.AI);
            }

            return(opponent);
        }
Exemplo n.º 5
0
 private void configureGameSettings(Board.eBoardSize i_BoardSize, GameLogic.eGameMode i_GameMode)
 {
     // this method is configuring the game settings
     m_GameLogic.configureGameSettings(i_BoardSize, i_GameMode);
     m_GameLogic.Initialize();
 }