Esempio n. 1
0
        public int PickStat(int initialStat)
        {
            int stat = initialStat;

            while (!_ValidAnswers.Contains(stat))
            {
                try
                {
                    stat = int.Parse(Console.ReadLine());
                    if (!_ValidAnswers.Contains(stat))
                    {
                        throw new ArgumentException();
                    }
                }
                catch (FormatException)
                {
                    ViewGarbage error = new ViewGarbage();
                    error.Print("Please enter a value '1', '2', '3', or '4'.");
                }
                catch (ArgumentException)
                {
                    ViewGarbage error = new ViewGarbage();
                    error.Print("Please enter a value in range 1-4.");
                }
            }
            SetCompareToStat(stat);
            return(stat);
        }
Esempio n. 2
0
 public GameController()
 {
     GameDeck = new Deck(new CardDAO(Environment.CurrentDirectory + @"..\..\..\..\Resorces\waste.csv"));
     GameDeck.Shuffle();
     TemporaryHand = new Hand();
     Player1       = new Player("Player1", true);
     Player1.Hand.GetHand(GameDeck);
     Player2 = new Player("Player2");
     Player2.Hand.GetHand(GameDeck);
     Comparer = new CardComparer();
     View     = new ViewGarbage();
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            ViewGarbage    View = new ViewGarbage();
            GameController Game = new GameController();

            View.Print("Welcome to the game.\nThe cards are already dealt.\nIt is Player1 turn...");
            System.Threading.Thread.Sleep(3000);
            while (!Game.AnyPlayerHasWon())
            {
                Game.PlayRound(Game.Player1, Game.Player2);
            }
            Game.EndGameScenario();
        }