Esempio n. 1
0
        private void checkWinner()
        {
            StringBuilder stringBuilder = new StringBuilder("***** RESULTS *****" + Environment.NewLine);

            if (m_FirstPlayer.Points < m_SecondPlayer.Points)
            {
                stringBuilder.AppendFormat("{0} is the WINNER!!!{1}", m_SecondPlayer.Name, Environment.NewLine);
            }
            else if (m_FirstPlayer.Points > m_SecondPlayer.Points)
            {
                stringBuilder.AppendFormat("{0} is the WINNER!!!{1}", m_FirstPlayer.Name, Environment.NewLine);
            }
            else
            {
                stringBuilder.AppendFormat("There is no winner, It's a Tie!!!{0}", Environment.NewLine);
            }

            stringBuilder.AppendFormat("{0}'s points: {1}{2}", m_FirstPlayer.Name, m_FirstPlayer.Points, Environment.NewLine);
            stringBuilder.AppendFormat("{0}'s points: {1}", m_SecondPlayer.Name, m_SecondPlayer.Points);
            m_UserActivety.Print(stringBuilder.ToString());
        }
Esempio n. 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 ******");
        }