void start() { YahtzeeGame YahtzeeGame = new YahtzeeGame(); //playYahtzeeGame(YahtzeeGame); playYahtzeeGameAdvanced(YahtzeeGame); }
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); } }
private void Start() { YahtzeeGame yg = new YahtzeeGame(); yg.Init(); PlayYahtzee(yg); }
static void Main(string[] args) { YahtzeeGame yahtzeeGame = new YahtzeeGame(); yahtzeeGame.dice = new Dice[5]; PlayYahtzee(yahtzeeGame); Console.ReadKey(); }
private void PlayYahtzee(YahtzeeGame game) { int amountcount = 0; do { game.Throw(); game.ShowValues(); amountcount++; }while (!game.Yahtzee()); Console.WriteLine("Aantal pogingen nodig voor yahtzee:{0}", amountcount); Console.ReadKey(); }
static void PlayYahtzee(YahtzeeGame game) { int tries = 0; do { game.Throw(); game.ShowValue(); tries++; } while (!game.FourOfAKind()); Console.WriteLine("Aantal pogingen nodig: " + tries); }
void playYahtzeeGame(YahtzeeGame game) { int iterations = 0; do { game.roll(); game.showResults(); iterations++; } while (!game.yahtzee()); Console.WriteLine($"Er waren {iterations} pogingen nodig voor yahtzee"); }
void Start() { YahtzeeGame yahtzee = new YahtzeeGame(); int aantalPogingen = 0; yahtzee.Init(); do { yahtzee.Gooi(); yahtzee.ToonWorp(); aantalPogingen++; } while (!yahtzee.Yahtzee()); Console.WriteLine($"Aantal pogingen: {aantalPogingen}"); Console.ReadKey(); }
void Start() { // Eerste deel /* Dobbelsteen d1, d2; * d1 = new Dobbelsteen(); // dobbelsteen 1 * d2 = new Dobbelsteen(); // dobbelsteen 2 * * d1.Gooi(); * d2.Gooi(); * * d1.ToonWaarde(); * d2.ToonWaarde(); */ // Tweede doel /* YahtzeeGame yahtzeeGame = new YahtzeeGame(); * yahtzeeGame.Init(); * * yahtzeeGame.Gooi(); // gooi * yahtzeeGame.ToonWorp(); // toon * * yahtzeeGame.Gooi(); * yahtzeeGame.ToonWorp(); */ // echte doel YahtzeeGame yahtzeeGame = new YahtzeeGame(); yahtzeeGame.Init(); SpeelYahtzee(yahtzeeGame); // speel het gemaakte spel Console.ReadKey(); }
void playYahtzeeGameAdvanced(YahtzeeGame game) { int iterations = 0; int threeOfAKindCount = 0; int fourOfAKindCount = 0; int fullHousesCount = 0; int smallStraightCount = 0; int fullStraightCount = 0; int pointsScoredByThreeOfAKind = 0; int pointsScoredByFourOfAKind = 0; int pointsScoredByFullHouses = 0; int pointsScoredBySmallStraights = 0; int pointsScoredByFullStraights = 0; do { game.roll(); Console.ForegroundColor = ConsoleColor.DarkGray; if (game.threeOfAKind()) { threeOfAKindCount++; Console.ForegroundColor = ConsoleColor.DarkGreen; pointsScoredByThreeOfAKind += game.diceValues.Sum(); } if (game.fourOfAKind()) { fourOfAKindCount++; Console.ForegroundColor = ConsoleColor.Green; pointsScoredByFourOfAKind += game.diceValues.Sum(); } if (game.fullHouse()) { fullHousesCount++; Console.ForegroundColor = ConsoleColor.Blue; pointsScoredByFullHouses += 25; } if (game.smallStraight()) { smallStraightCount++; Console.ForegroundColor = ConsoleColor.Red; pointsScoredBySmallStraights += 30; } if (game.fullStraight()) { fullStraightCount++; Console.ForegroundColor = ConsoleColor.Magenta; pointsScoredByFullStraights += 40; } game.showResults(); iterations++; } while (!game.yahtzee()); writeLineInColor( ConsoleColor.DarkGreen, $"Three of a kind: {threeOfAKindCount} ({pointsScoredByThreeOfAKind} punten)" ); writeLineInColor( ConsoleColor.Green, $"Four of a kind: {fourOfAKindCount} ({pointsScoredByFourOfAKind} punten)" ); writeLineInColor( ConsoleColor.Blue, $"Full houses: {fullHousesCount} ({pointsScoredByFullHouses} punten)" ); writeLineInColor( ConsoleColor.Red, $"Small Straights: {smallStraightCount} ({pointsScoredBySmallStraights} punten)" ); writeLineInColor( ConsoleColor.Magenta, $"Full Straights: {fullStraightCount} ({pointsScoredByFullStraights} punten)" ); int totalPoints = pointsScoredByThreeOfAKind + pointsScoredByFourOfAKind + pointsScoredByFullHouses + pointsScoredBySmallStraights + pointsScoredByFullStraights + 50; Console.WriteLine($"Je heb in totaal {totalPoints} punten gescoord."); Console.WriteLine($"Er waren {iterations} pogingen nodig voor yahtzee"); }