Exemple #1
0
        void SpeelYahtzee(YahtzeeGame game)
        {
            int aantalpogingen = 0;

            do
            {
                game.Gooi();
                game.ToonWorp();

                aantalpogingen++;
            }while (!game.Yahtzee() && !game.FourOfAKind() && !game.ThreeOfAKind());

            // Ga na volgens de yahtzee hierarchie welke er is gegooid en hoe lang dat duurde
            if (game.Yahtzee())
            {
                Console.WriteLine("Aantal pogingen nodig voor Yahtzee: {0}", aantalpogingen);
            }
            else if (game.FourOfAKind())
            {
                Console.WriteLine("Aantal pogingen nodig voor Four Of A Kind: {0}", aantalpogingen);
            }
            else if (game.ThreeOfAKind())
            {
                Console.WriteLine("Aantal pogingen nodig voor Three Of A Kind: {0}", aantalpogingen);
            }
        }
Exemple #2
0
        static void PlayYahtzee(YahtzeeGame game)
        {
            int tries = 0;

            do
            {
                game.Throw();
                game.ShowValue();
                tries++;
            } while (!game.FourOfAKind());

            Console.WriteLine("Aantal pogingen nodig: " + tries);
        }