IB Comp Sci SL - November 21 2016 Lesson Notes: Difference between revisions
Mr. MacKenty (talk | contribs) |
Mr. MacKenty (talk | contribs) |
||
Line 17: | Line 17: | ||
==[[file:homework.png]] Homework == | ==[[file:homework.png]] Homework == | ||
A common mechanic in computer games is to simulate a dice roll. [http://product-images.highwire.com/2370673/gray-opaque-rpg-dice.jpg Please click here to see an image of different types of dice]. Please write a function that rolls dice for you and RETURNS the result. | |||
for example: roll_dice(d6,3) <-- would roll a six sided die 3 times and return the result | |||
for example: roll_dice(d12,1) <-- would roll a 12 sided dice 1 and return the result | |||
for example: roll_dice(d20,4) <-- would roll a 20 sided die 4 times and return the result. | |||
You should model a 4 sided, 6 sided, 10 sided, 12 sided, and 20 sided die. | |||
As extra-credit, you might want to return the result of each roll and then the final total. | |||
for example: roll_dice(d6,3) <-- might return 6 3 1 10 | |||
</td> | </td> |
Revision as of 10:24, 21 November 2016
What are we going to learn today?[edit]
|
Homework[edit]A common mechanic in computer games is to simulate a dice roll. Please click here to see an image of different types of dice. Please write a function that rolls dice for you and RETURNS the result. for example: roll_dice(d6,3) <-- would roll a six sided die 3 times and return the result for example: roll_dice(d12,1) <-- would roll a 12 sided dice 1 and return the result for example: roll_dice(d20,4) <-- would roll a 20 sided die 4 times and return the result. You should model a 4 sided, 6 sided, 10 sided, 12 sided, and 20 sided die. As extra-credit, you might want to return the result of each roll and then the final total. for example: roll_dice(d6,3) <-- might return 6 3 1 10
|
|
How am I being assessed today?[edit]
|
||
Standards we are covering today[edit]
|
As a computer scientist, you have:[edit]
|
|
Credits[edit] |