<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 07/11/13 19:49,&nbsp; wrote:<br>
    </div>
    <blockquote
cite="mid:C40B2F181831EF44A88CD735258278030261C41C53@MERCERMAIL.MercerU.local"
      type="cite">
      <pre wrap="">For the dice assignment I am confused as to what I am trying to modify it to do. It says consistent results and I don't know if that means every time I run it I have to get 7 as the most frequent number or to get a 7 just once? I guess I'm also confused as to what to modify. 

Thanks 

</pre>
    </blockquote>
    <br>
    Hopefully this helps you out.<br>
    <br>
    <b><big>Part 1:&nbsp;</big> </b><br>
    <br>
    The first thing you need to do is make sure the program you download
    from BlackBoard runs on your computer.&nbsp; It should run with no
    problem and produce output that looks something like.<br>
    <br>
    <br>
    <small><font face="Courier New, Courier, monospace">Roll&nbsp;&nbsp;&nbsp; Number
        of Occurrences<br>
        ------- ---------------------<br>
        1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>
        2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>
        3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>
        4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br>
        5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3<br>
        6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0<br>
        7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br>
        8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br>
        9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br>
        10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br>
        11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br>
        12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1<br>
        <br>
        The number that was rolled most frequently was 5</font></small><br>
    <br>
    When you run the program the "number that was rolled most
    frequently" may be different.&nbsp; Probability tells us that the number
    should be seven, but because we are only rolling the dice in this
    program 10 times, we are not using a sample set that is big enough
    statistically for the rules of probability to be applicable.&nbsp;&nbsp; To
    verify that, try and run the program ten times and see if you get
    the same number every time.&nbsp; Most likely you will not.<br>
    <br>
    Now, edit the program.&nbsp; Look on line 12, you should see the
    statement<br>
    <br>
    <small><font face="Courier New, Courier, monospace">max_rolls = 10</font></small><br>
    <br>
    Let's change that to <br>
    <br>
    <small><font face="Courier New, Courier, monospace">max_rolls = 100</font></small><br>
    <br>
    and rerun the program ten times.&nbsp; Did you get the same number every
    time?&nbsp; If not increase the value of <small><font face="Courier New,
        Courier, monospace">max_rolls</font></small> to 1000 and try
    again.&nbsp;&nbsp; What I want to know is what number do you have to set <small><font
        face="Courier New, Courier, monospace">max_rolls</font></small>
    so that you get the same number rolled most frequently every time.<br>
    <br>
    <big><b>Part 2:</b></big><br>
    <br>
    In the part of the assignment where you create the threedice.py
    program you have to make four MODIFICATIONS to the code you
    downloaded so that it now rolls three six-sided dice.<br>
    <br>
    From the top of the code coming down here are some of the things you
    have to do:<br>
    <br>
    <i>Change #1:</i><br>
    <br>
    At the appropriate place ADD a line<br>
    <br>
    <small><font face="Courier New, Courier, monospace">faces_on_dice_three
        = 6</font></small><br>
    <br>
    <i>Change #2</i><br>
    <br>
    MODIFY the line <br>
    <br>
    <small><font face="Courier New, Courier, monospace">roll = [0] * ( (
        faces_on_dice_one + faces_on_dice_two ) + 1 )</font></small><br>
    <br>
    to <br>
    <br>
    <small><font face="Courier New, Courier, monospace">roll = [0] * ( (
        faces_on_dice_one + faces_on_dice_two + faces_on_dice_three ) +
        1 )</font></small><br>
    <br>
    <i>Change #3</i><br>
    <br>
    In the "for i" loop, change it from <br>
    <br>
    <small><font face="Courier New, Courier, monospace">&nbsp; dice1 =&nbsp;
        random.randrange(1,faces_on_dice_one+1,1)<br>
        &nbsp; dice2 =&nbsp; random.randrange(1,faces_on_dice_two+1,1)<br>
        <br>
        &nbsp; roll[dice1+dice2] = roll[dice1+dice2] + 1</font></small><br>
    <br>
    <br>
    to<br>
    <br>
    <small><font face="Courier New, Courier, monospace">&nbsp; dice1 =&nbsp;
        random.randrange(1,faces_on_dice_one+1,1)<br>
        &nbsp; dice2 =&nbsp; random.randrange(1,faces_on_dice_two+1,1)<br>
        &nbsp; dice3 =&nbsp; random.randrange(1,faces_on_dice_three+1,1)<br>
        <br>
        &nbsp; roll[dice1+dice2+dice3] = roll[dice1+dice2+dice3] + 1</font></small><br>
    <br>
    <i>Change #4</i><br>
    <br>
    In the last for loop change it from<br>
    <br>
    <small><font face="Courier New, Courier, monospace">for i in
        range(1,faces_on_dice_one+faces_on_dice_two+1):<br>
      </font></small><br>
    to <br>
    <br>
    <small><font face="Courier New, Courier, monospace">for i in
        range(1,faces_on_dice_one+faces_on_dice_two+faces_on_dice_three+1):</font></small><br>
    <br>
    Once you have made all the changes, make sure the program runs and
    then answer the same question you had to answer in Part 1 -- i.e.
    "To what value must I set <small><font face="Courier New, Courier,
        monospace">max_rolls</font></small> so that I get the same
    result every time."<br>
    <br>
    <br>
    <big><b>Part 3:</b></big><br>
    <br>
    In part three you are doing to basically do the exact same thing you
    did in part two, but now your program needs to have five dice --
    each with a different number of sides.&nbsp; You start this by now
    changing and adding lines to the first part of the program.<br>
    <br>
    Change:<br>
    <br>
    <small><font face="Courier New, Courier, monospace">faces_on_dice_one
        = 6<br>
        faces_on_dice_two = 6<br>
        faces_on_dice_three = 6</font></small><br>
    <br>
    to<br>
    <br>
    <small><font face="Courier New, Courier, monospace">faces_on_dice_one
        = 4<br>
        faces_on_dice_two = 6<br>
        faces_on_dice_three = 8<br>
        faces_on_dice_four = 12<br>
        faces_on_dice_five = 20</font></small><br>
    <br>
    Then perform the last three changes you did in Part 2 to now make
    the program handle five dice and not just three.&nbsp; Once your program
    is running, answer the same question "To what value must I set <small><font
        face="Courier New, Courier, monospace">max_rolls</font></small>
    so that I get the same result every time."<br>
    <br>
    <br>
    As always, let me know what questions you have.<br>
    <br>
    <br>
    <br>
    <br>
    <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>