Beispiel #1
0
        public static void Main(string[] args)
        {
            Board    board    = new Board();
            Game     game     = new Game(board);
            CheckWin checkWin = new CheckWin();
            UI       ui       = new UI();

            ui.introduction();


            while (game.PlaysAgain.Equals("Y"))
            {
                board.initializeVariable();
                while (checkWin.hasWon(board.currentBoard) == false && game.Counter < 9)
                {
                    game.askData("X");
                    if (checkWin.hasWon(board.currentBoard) == true || game.Counter == 9)
                    {
                        break;
                    }
                    game.askData("O");
                }
                if (checkWin.hasWon(board.currentBoard) == true)
                {
                    ui.playAgainMsg("Congradulation! You won!");
                }
                else
                {
                    ui.playAgainMsg("Sorry, but this was a tie game!");
                }
            }
            ui.goodBye();
        }
Beispiel #2
0
        public void Update(GameTime gameTime, InputHandler inputHandler)
        {
            collide.update(gameTime, inputHandler, resetRectangle);
            openGate = checkWin.hasWon();

            if (openGate)
            {
                rectangles.Remove(gateRectangle);
                if (checkWin.gotKey(actors, keyRectangle))
                {
                    Console.WriteLine("WIN");
                    state.ChangeState(new MainMenuState(state));
                }
            }
        }