TLP - Programming Maintenance
Week 13 - One roll of Farkle
NOTE: You may work on this with a single partner. Each of you is responsible for submitting the code in your own account on Autolab. Please make sure that the name of both partners is written in a comment block at the top of the code you submit to Autolab.
Background
In week 10 we started working with Farkle. This week we are going to continue. As a reminder, a full turn of Farkle for one player goes like this:
- A player rolls six dice.
- It is highly likely that there will be some dice that score points. If so
- The player may quit their turn taking the points earned, or
- The player may set aside one or more dice that score points and then roll the remaining dice
- If at anytime the player has set aside all six dice as scoring dice than they can pick up all six dice and continue scoring points by rolling all six dice.
- If at anytime the player rolls N dice and none of those N produce scoring dice than the player loses ALL points accumulated that round and earns a score of 0.
If you would like to watch a video with some sample rolls you can watch this video
While there are multiple scoring schedules for this game, I will ask that you use this one:
Roll Combination | Points Scored |
---|---|
Individual 1's | 100 points each |
Individual 5's | 50 points each |
Three 1's | 1,000 points |
Three 2's | 200 points |
Three 3's | 300 points |
Three 4's | 400 points |
Three 5's | 500 points |
Three 6's | 600 points |
1-2-3-4-5-6 | 3,000 points |
Three pairs (including 4-of-a-kind and a pair) | 1,500 points |
Task
- Using your code from week 10 to help you, add some functions methods in support of:
- Function name
- calculateScore()
- Parameters
- a list of six numbers
- Return value
- The integer score of the six dice rolled
- Examples
Note, it is very likely that a GOOD design will consist of several helper functions in addition to the two you created in week 10. Please don't take my statement to "write a function" to mean that there can only be one function.