protected int[] sequenceRollOfDices(Player player) { int sleep = 2000; //First roll int[] rollDice = m_yahtzeeGame.rollDice(player); m_yahtzeeView.showDices(rollDice); m_yahtzeeView.showIfUserWantsToHold(); //Checks if player wants to hold any dices int[] diceHold = m_yahtzeeGame.holdedDice(); //User Pressed enter and not held any dices if (diceHold == null || diceHold.Length == 0) { //Second roll rollDice = m_yahtzeeGame.rollDice(player); m_yahtzeeView.showDices(rollDice); m_yahtzeeView.showIfUserWantsToHold(); //Checks if player wants to hold any dices diceHold = m_yahtzeeGame.holdedDice(); //User Pressed enter and not held any dices //Returns the last roll of dices if (diceHold == null || diceHold.Length == 0) { //Third roll rollDice = m_yahtzeeGame.rollDice(player); m_yahtzeeView.showDices(rollDice); m_yahtzeeView.showFinalDices(player.getRolledDices()); Thread.Sleep(sleep); return player.getRolledDices(); ; } //User wanted to hold dice's else { //Holds the dices in array diceHold = m_yahtzeeGame.holdDice(player, diceHold, rollDice); m_yahtzeeView.showTheDicesHeld(diceHold); //Rolls the remaining dices //Third roll rollDice = m_yahtzeeGame.rollDice(player); m_yahtzeeView.showFinalDices(player.getRolledDices()); Thread.Sleep(sleep); //returns the final dices return player.getRolledDices(); } } //User wanted to hold dice's else { diceHold = m_yahtzeeGame.holdDice(player, diceHold, rollDice); m_yahtzeeView.showTheDicesHeld(diceHold); //Second roll rollDice = m_yahtzeeGame.rollDice(player); m_yahtzeeView.showDices(rollDice); m_yahtzeeView.showIfUserWantsToHold(); //Checks if player wants to hold any dices int[] diceHold2 = m_yahtzeeGame.holdedDice(); if (diceHold2 == null || diceHold2.Length == 0) { //Third roll rollDice = m_yahtzeeGame.rollDice(player); m_yahtzeeView.showDices(rollDice); m_yahtzeeView.showFinalDices(player.getRolledDices()); Thread.Sleep(sleep); //returns the final dices return player.getRolledDices(); } else { diceHold = m_yahtzeeGame.holdDice(player, diceHold2, rollDice); m_yahtzeeView.showTheDicesHeld(diceHold); rollDice = m_yahtzeeGame.rollDice(player); m_yahtzeeView.showDices(rollDice); m_yahtzeeView.showFinalDices(player.getRolledDices()); Thread.Sleep(sleep); //returns the final dices return player.getRolledDices(); } } }