Example #1
0
    public static void Main()
    {
        GameLogic gameLogic = new GameLogic();
        string gamestate = "new";

        while (gamestate != "over")
        {
            Deck deck1 = new Deck();
            string action;

            if (gamestate == "new")
            {
                Console.WriteLine("New game!");

                gamestate = "playing";

            }
            else if (gamestate == "playing")
            {
                Hand playerHand = new Hand();
                Hand dealerHand = new Hand();

                deck1.DealHand(playerHand);
                deck1.DealHand(dealerHand);

                Console.WriteLine("You were dealt: ");
                playerHand.DisplayHand();

                action = Console.ReadLine();

                if (action == "H")
                {
                    deck1.DealCard(playerHand);
                    Console.WriteLine("Your hand is: ");
                    playerHand.DisplayHand();
                    Console.WriteLine("Your score is: ");
                    Console.WriteLine(playerHand.Score());
                    gameLogic.CompareScores(playerHand.Score(), dealerHand.Score());
                }

                gamestate = "over";
            }
        }
    }