title: GAME Java random generator with cubes, while if do while
body: <p>Lovely people,
  I'm stuck with my java program. If i run my program it doesn't work how it is supposed to work. If computerSpeler throws 1 or 2x 1, it should be mensSpeler his turn. What is wrong with my program?</p>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.Random;
  
  public class Spel {
      private EgbertComputerSpeler computerSpeler;
      private MensSpeler mensSpeler;
      private boolean mensSpelerBegint;
      public static final int HET_SPEL_IS_UIT_SCORE = 100;
      private int dobbelsteen1;
      private int dobbelsteen2;
      private Random generator = new Random();
      private int scoreComputer;
      private int scoreMens;
      private int worpen;
      private int beurt;
  
      public Spel() {
          computerSpeler = new EgbertComputerSpeler(HET_SPEL_IS_UIT_SCORE);
          mensSpeler = new MensSpeler(HET_SPEL_IS_UIT_SCORE);
  
          mensSpelerBegint = generator.nextBoolean();
      }
  
      public void dobbel() {
          dobbelsteen1 = generator.nextInt(6) + 1;
          dobbelsteen2 = generator.nextInt(6) + 1;
  
          worpen = worpen + 1;
          beurt = beurt + dobbelsteen1 + dobbelsteen2;
      }
  
      public void speelSpel() {
          while (scoreMens &lt;100 || scoreComputer &lt; 100) {
              if (mensSpelerBegint) {
                  do {
                      dobbel();
  
                      if (dobbelsteen1 == 1 &amp;&amp; dobbelsteen2 == 1) {
                          scoreMens = scoreMens + 25 ;
                          mensSpelerBegint = false;
                      }
  
                      else if (dobbelsteen1 == 1 || dobbelsteen2 == 1) {
                          scoreMens = scoreMens + 0 ;
                          mensSpelerBegint = false;}
                  } while (mensSpeler.wilGooien(false, worpen,
                                                scoreMens, scoreComputer));
  
                  scoreMens = beurt + scoreMens;
                  worpen = 0;
                  beurt = 0;
              }
  
              else {
                  do {
                      dobbel();
  
                      if (dobbelsteen1 == 1 &amp;&amp; dobbelsteen2 == 1) {
                          scoreComputer = scoreComputer + 25;
                          mensSpelerBegint = true;}
  
                      else if (dobbelsteen1 == 1 || dobbelsteen2 == 1) {
                          scoreComputer = scoreComputer + 0;
                          mensSpelerBegint = true;}
                  } while (computerSpeler.wilGooien(false, worpen,
                                                    scoreMens, scoreComputer));
  
                  scoreComputer = beurt + scoreComputer;
                  worpen = 0;
                  beurt = 0;
              }
          }
      }
  }
  </code></pre>
  
  <p>Thanks!</p>