Example #1
0
        private void playTurn(ref Player io_Player)
        {
            string firstSlot  = null;
            string secondSlot = null;

            if (!io_Player.Name.Equals("Computer"))
            {
                firstSlot = m_UserActivety.GetSlotFromUser(m_Board, ref io_Player);
                m_Board.ShowBoardSlot(firstSlot);
                m_UserActivety.PrintBoard(m_Board);
                secondSlot = m_UserActivety.GetSlotFromUser(m_Board, ref io_Player);
                m_Board.ShowBoardSlot(secondSlot);
                m_UserActivety.PrintBoard(m_Board);
            }
            else
            {
                computerTurn(ref firstSlot, ref secondSlot);
                m_UserActivety.Print("Computer Turn... Please wait for your turn");
            }

            Thread.Sleep(2000);
            setTurnResult(ref io_Player, firstSlot, secondSlot);
            m_UserActivety.PrintBoard(m_Board);
        }
Example #2
0
        private static void runApp()
        {
            CharValues           values       = new CharValues();
            UserActivety <char?> userActivity = new UserActivety <char?>();
            Player firstPlayer = new Player();
            Player secondPlayer = new Player();
            int    length = 0, hight = 0;
            bool   newGame = true;

            userActivity.GetMainPlayerInput(ref firstPlayer, ref secondPlayer);
            while (newGame)
            {
                userActivity.GetBoardSize(ref length, ref hight);
                Board <char?> board = new Board <char?>(length, hight, values.CharList);
                Game <char?>  game  = new Game <char?>(board, ref firstPlayer, ref secondPlayer);
                userActivity.PrintBoard(board);
                game.PlayGame();
                newGame = userActivity.StartNewGame();
            }

            userActivity.Print("****** Game Over! Bye Bye ******");
        }