Ejemplo n.º 1
0
        /// <summary>
        /// Returns the final winner along with some game statistics.
        /// </summary>
        /// <param name="game"></param>
        /// <returns></returns>
        public static string PrintFinalWinner(CardGameWar game)
        {
            string result = string.Format("<h2> Final winner is {0}.</h2>" +
                                          "<br/>Game duration: {1:N2} milliseconds." +
                                          "<br/>Number of rounds: {2}" +
                                          "<br/>Number of wars: {3}", game.Winner, game.GameDuration.TotalMilliseconds, game.RoundCount, game.WarCount);

            return(result);
        }
Ejemplo n.º 2
0
 private static string PrintRoundWinner(CardGameWar game)
 {
     if (game.Mode == PlayMode.Normal)
     {
         return(string.Format("<b>{0} wins!</b>", game.Winner));
     }
     else
     {
         return(string.Format("==========> <b>WAR</b> <=========="));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns battle cards, bounty, and the round winner. It returns the status of players.
        /// </summary>
        /// <param name="warGame"></param>
        /// <returns></returns>
        public static string PrintRoundResult(CardGameWar warGame)
        {
            string result = string.Empty;

            result += PrintHeader(string.Format("Round {0}:", warGame.RoundCount));
            result += PrintBattle(warGame.Table) + "<br/>";
            result += PrintBounty(warGame.Table) + "<br/>";
            result += PrintRoundWinner(warGame) + "<br/>";
            result += PrintAllPlayersStatus(warGame);

            return(result);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns all players' hands.
 /// </summary>
 /// <param name="game"></param>
 /// <returns></returns>
 public static string PrintAllPlayersHand(CardGameWar game)
 {
     return(string.Format("{0} <br/><br/> {1}",
                          PrintPlayerHand(game.Player1), PrintPlayerHand(game.Player2)));
 }
Ejemplo n.º 5
0
 private static string PrintAllPlayersStatus(CardGameWar game)
 {
     return(string.Format("{0}: {1}<br/>{2}: {3}",
                          game.Player1.Name, PrintPlayerStatus(game.Player1),
                          game.Player2.Name, PrintPlayerStatus(game.Player2)));
 }