<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><font face="serif">In the past 48 hours I have talked to several
        of you that are having great trouble figuring out how to have
        the loops keep running while you are rolling for certain
        numbers.   Here is an example from some of my old code for how
        you might do this...</font></p>
    <p>      <br>
      <code>        String roll;</code><code><br>
      </code><code>        String pokerHand;</code><code><br>
      </code><code>        int totalScore = 0;</code><code><br>
      </code><code>        int bonus;</code></p>
    <p><code>        boolean doneWithOnes = false;</code></p>
    <p><code>        System.out.println("    *** ROLLING FOR ONES ***");</code><code><br>
      </code><code>        while (!doneWithOnes) {</code><code><br>
      </code><code>            int handScore = 0;</code><code><br>
      </code><code>            roll = Dice.roll();</code><code><br>
      </code><code>            doneWithOnes = !foundInRoll(roll,1);</code><code>        
        // See if there is one in the roll<br>
      </code><code>            if (!doneWithOnes) {</code><code><br>
      </code><code>                System.out.print( roll + "  " );</code><code><br>
      </code><code>                handScore =
        countNumberInHand(roll,1);   // Count and sum up the ones</code><code><br>
      </code><code>                System.out.print( handScore );</code><code><br>
      </code><code>                pokerHand =
        whichPokerHand(roll);           // Figure out which hand we have</code><code><br>
      </code><code>                System.out.print( "   --&gt;  " +
        pokerHand );</code><code><br>
      </code><code>                bonus =
        bonusFromPokerHand(roll);           // Determine points the
        points for the hand</code><code><br>
      </code><code>                System.out.print( "(+" + bonus + ")  
        --&gt;  ");</code><code><br>
      </code><code>                totalScore = totalScore + handScore +
        bonus;  // Accumulate total points</code><code><br>
      </code><code>                System.out.println( totalScore );</code><code><br>
      </code><code>            }</code><code><br>
      </code><code>            else {</code><code><br>
      </code><code>                System.out.println( roll );</code><code><br>
      </code><code>            }</code><code><br>
      </code><code>        }</code><code><br>
      </code></p>
    <p><br>
    </p>
    <p>Then below this there are five more loops (for 2, 3, 4, 5, 6) and
      after that I have all my static methods.</p>
    <p>Hope this helps some of you make progress before class on Friday.<br>
    </p>
    <br>
    <pre class="moz-signature" cols="72">-- 
Andrew J. Pounds, Ph.D.  (<a class="moz-txt-link-abbreviated" href="mailto:pounds_aj@mercer.edu">pounds_aj@mercer.edu</a>)
Professor of Chemistry and Computer Science
Mercer University,  Macon, GA 31207   (478) 301-5627
<a class="moz-txt-link-freetext" href="http://faculty.mercer.edu/pounds_aj">http://faculty.mercer.edu/pounds_aj</a>
</pre>
  </body>
</html>