I'm not going to try and deny it: I'm a complete nerd. Anime. Magic: the Gathering. Brandon Sanderson. Dungeons and Dragons. I love it all. For the lab today, we are going to work on an interactive dice roller application.
The following is a list of commonly rolled dice:
- D4
- D6
- D8
- D10
- D12
- D20
The number next to D
signifies the number of sides on the given die. In many situations, players will add a bonus to their roll, so this project should include the ability to add an optional numerical bonus.
For example, let's say my character is attempting to detect a secret passage on the wall of the dungeon. The DM (Dungeon Master) has my character roll a Perception
check. I roll a D20
and get a 14. My Wisdom
stat grants me a +3
bonus to all wisdom-related ability checks. And perhaps my character is proficient in the Perception
skill. At my current level I would get a +2
bonus for proficiency.
In the above example, my total roll would be 19
(14 + 3 + 2). As you are working on this project, think of how you can implement the ability to account for bonuses. I'll leave the actual implementation up to you.
If you were not able to attend the lab in person, check out the slide deck here for some of the basics of Ruby.
I used the following resources while putting this project together: