Exemplo n.º 1
0
        public void runGame()
        {
            while (!referee.Winner(playerBlack, playerWhite))
            {
                playerBlack.updateState();
                playerWhite.updateState();

                string currentPlayer = referee.getcurrentPlayer();
                //PLACING
                if (currentPlayer == "Black")
                {
                    if (playerBlack.getState() == "Placing")
                    {
                        placeCow(playerBlack);
                    }
                    else if (playerBlack.getState() == "Moving")
                    {
                        Moving(playerBlack);
                    }
                    else
                    {
                        Flying(playerBlack);
                    }
                    if (referee.isMill(playerBlack))
                    {
                        afterMill(playerBlack);
                    }
                }

                if (currentPlayer == "White")
                {
                    if (playerWhite.getState() == "Placing")
                    {
                        placeCow(playerWhite);
                    }
                    else if (playerWhite.getState() == "Moving")
                    {
                        Moving(playerWhite);
                    }
                    else
                    {
                        Flying(playerWhite);
                    }
                    if (referee.isMill(playerWhite))
                    {
                        afterMill(playerWhite);
                    }
                }

                referee.swapcurrentPlayer();
                Board.printBoard(Board.getBoard());
            }

            if (playerBlack.numberOfCows() == 2)
            {
                Console.WriteLine("GAMEOVER!!!!\nWhite has won");
            }
            else if (playerWhite.numberOfCows() == 2)
            {
                Console.WriteLine("GAMEOVER!!!!\nBlack has won");
            }
            else
            {
                Console.WriteLine("GAMEOVER!!!!\nIt's a draw");
            }
        }