Reference no: EM132310779
Assignment Task: Farkle (a dice game) Game Overview:
In this assignment, you are to write dice game, where you roll six dice to create a range of scoring combinations. The first player to reach or exceed the target score is declared the winner! Any number of players may play, however, for the basic assignment you only need to implement one.
Basic Game Play:
In this program, you will control a set of six dice. On your turn, you must make as many scoring combinations (as outlined below) as you wish to score points towards the winning target score. The basic game play is as follows:
• One player is randomly chosen to go first. Players take turns in clockwise order. The game is played in rounds in which each player has a turn to roll the dice and score points.
• On your turn:
• Roll all six dice and set aside at least one die of a scoring value, (as shown below):
Dice
|
Points
|
Dice
|
Points
|
1's
|
100 each
|
3x3's
|
300
|
5's
|
50 each
|
3x4's
|
400
|
3x1's
|
1000
|
3x5's
|
500
|
3x2's
|
200
|
3x6's
|
600
|
Combinations only count when made in a single throw.
• You may now decide whether to score your points and end your turn or you can re-roll the remaining dice.
If you choose to roll again, you can keep rolling the dice, until you choose to stop or you roll no scoring values. Rolling no scoring values is called a FARKLE.
If you roll a FARKLE, you score NO POINTS for this round and your turn ends. Pass the dice to the next player.
If you set aside all 6 dice, you may re-roll all 6 dice and continue adding to your score, following all the rules above.
• The first player to score 5,000 or more points wins the game.
There are many variations to this basic game, some of which you will be able to implement as part of the extra functionality for your assignment.
A Typical Player Turn:
During a player's turn, the logic is as follows:
1) First, the player must roll all 6 dice to produce 6 random numbers from 1-6.
2) Next, they set aside at least one die that scores points (a single 1 or 5, or 3-of-a-kind). The points for which are stored in a running total for the player's turn. These dice cannot be rolled again, until after all 6 dice are set aside (see Step 4).
3) The player is presented with 2 options - roll the dice or score their points.
If they choose to score, the running total is added to their player score and their turn ends.
If they roll again, only those dice not set aside are rolled. Steps 2 and 3 may be repeated as often as the player wishes, until they use all 6 dice (Step 4) or roll a Farkle (Step 5).
4) If the player sets aside all 6 dice, they start again with all 6 dice and continue scoring as before this is called a Bonus Roll. Steps 2 and 3 may be repeated as often as the player wishes.
5) A Farkle is a roll with no scoring values - the player cannot take a single 1 or 5, or 3-of-a-kind. When this happens, the player ends their turn immediately and does not score the points rolled during that turn. Their saved score is not changed.
Here is an example roll for a player's turn:
• On their first roll, the player rolls a 1, 2, 3, 3, 5, 5.
• They can score 100 points for the 1, or 100 points for both 5s, or 50 points for 1 of the 5s, or 200 points for the 1 and both 5s.
• They choose to set aside just the 1 for 100 points and roll the 5 remaining dice again.
• This time they roll a 2, 3, 6, 6, 6. They decide to take the 600 points for the 3-of-a-kind in 6s.
• Their running total is now 700 points. This is a good score so they opt to save their points and end their turn.
Extra Functionality
The marking criteria indicates that you should make some individual additions to this in order to achieve the final 20% of the mark.
Following is a list of additional features you can include, with the maximum number of marks [x] you can earn for each one. You may implement one or more features from the list, but you will only be able to score a maximum of 20% of the marks.
• Include multiple human players making the game playable by 1 to 4 people. At the beginning of the game the player order must be randomised. Each player must track their own score and display their name and game score when required.
• If a player rolls three Farkles in a row (on three consecutive turns) they lose 1000 points from their saved score. Once they lose the points the counter for Farkles is reset to zero.
• Allow the players to choose the target score and the minimum points required to roll before saving points. Targets = 5,000 points, 10,000 points or 15,000 points. Minimum roll required = 350 points, 500 points, 750 points or 1000 points.
• Display the dice using ASCII art, showing the faces as pips not as numbers.
• When the first player reaches or exceeds the target score, all other players (in a multi-player game) have one final turn to try and beat that score. In this case, the player at the end of the round with the highest score wins.
• The basic game includes the minimal scoring options to make the game playable. However, you can include three or more of the following scoring combinations to make the game more interesting.
Dice
|
Points
|
Dice
|
Points
|
3 pairs
|
1000
|
straight*
|
1500
|
2x3-of-a-kind
|
2000
|
4-of-a-kind
|
2x points
|
5-of-a-kind
|
3x points
|
6-of-a-kind
|
instant win
|
• Allow the game to be played with computer players. The computer player should be able to make reasonably intelligent decisions for choosing scoring combinations and when to save their points. This AI can be a set of rules that the computer player checks before making a roll or when to save their score. [10]
• Implement a more sophisticated AI for the computer players. You may create different player types, each with their own strategies for playing, such as an easy player, a cautious player, an aggressive player, etc. The human player should be able to select the level of difficulty and number of their opponents at the beginning of the game. [10]
You certainly do not have to implement all of the above to earn marks for extra functionality. Just remember the maximum marks you can earn are given in the brackets [x]. It is up to you!
Program Design Diagram*
In this final assignment you are able to design your program in any way you like. You must provide a diagram with annotation that shows the classes you have in your program and how they interact. It should contain any relevant notes that describe the classes.
These diagrams should include appropriate UML diagrams as covered during class, including the basic class diagram notation for public, private and protected data and functions.
Program Reflection*
You must provide a 300-word written reflection of your object-oriented design and how well you believe it was to implement. You should cover the following areas:
• Discuss why you designed it the way you did.
• Discuss how well you were able to code it, highlighting any issues you found once you tried to implement your design.
• If you were to do this project again, discuss how you might change your design to make your solution easier to implement, more efficient, or better for code reuse.
Suggested Development Process
Below is a suggested process you might use to develop your assignment piece by piece so that it is not too overwhelming. Feel free to follow this if you think it will help (or not!).
1) Design the program on paper.
• Decide what classes you think you need and how they will relate to each other.
• Write down your thoughts on why you think this is the best design.
• You need to do this for the assignment anyway!
• Remember how you can use inheritance and pointers.
2) Write a simple class that you need and test it!
3) Write another simple class that you need and test it!
4) Do these two classes interact? If so, see if you can get basic interaction happening!
• Hint: I imagine some objects are going to battle...
5) Repeat the process for each additional class or function
• Either add to existing classes or write new ones if you need to.
• Remember, just focus on the small specific task!
Attachment:- Fundamentals of C++.rar