CSP1150D Programming Principles
Assignment: Individual Programming assignment (Dice Game)
Assignment Marks: Marked out of 20, (20% of unit result)
Due Date: TBA(see moodle)
Background Information
This assignment tests your understanding of and ability to apply the programming concepts we have
covered in the unit so far, including the usage of variables, input/output, data types, selection,
iteration, functions, and data structures.
Pseudocode
As emphasised in the case study of Module 5, it is important to take the time to properly design a
solution before starting to write code. Hence, this assignment requires you to write and submit
pseudocode of your program design as well as the code for the program. Furthermore, while your
tutors are happy to provide help and feedback on your assignment work throughout the semester,
they will expect you to be able to show your pseudocode and explain the design of your code.
Write a separate section of pseudocode for each function in your program.
Assignment Requirements
You are required to design and implement a Dice Game program that runs a short game that uses
dice. The rules of each dice game are available on moodle make sure you do the dice game
allocated to you.
Implement all the following requirements and ask your tutor if you do not understand any of the
requirements.
1. The program should welcome the user and ask how many players (1…4).
2. The program should briefly explain the rules of the game.
3. Depending on the game each player should have their turn and the results displayed.
4. The program should keep a record of the winner of the game.
5. After the results are displayed the user should be asked if they wish to play again.
6. If they answer y then the program should repeat from the beginning.
The following shows a sample run if the game was simply highest roll of two dice (your game
WILL be different but turn order and reporting should be similar):
Submission of Deliverables
Once your assignment is complete, submit both your pseudocode (PDF or DOC format no .pages
files) and source code (.py files) to the appropriate locations on moodle. An assignment cover
sheet is not required but be sure to include your name and student number at the top of both files.
Referencing, Plagiarism and Collusion
The entirety of your assignment must be your own work (unless otherwise referenced) and
produced for the current instance of the unit. Any use of unreferenced content you did not create
constitutes plagiarism and is deemed an act of academic misconduct. All assignments will be
submitted to plagiarism checking software which includes previous copies of the assignment.
Remember that this is an individual assignment. Never give anyone any part of your assignment
even after the due date or after results have been released. Do not work together with other
students on individual assignments helping someone by explaining errors in their code/logic or
directing them to the relevant resources is appropriate but doing it for them or showing them how
you did it is not. An unacceptable level of cooperation between students on an assignment is
collusion and is deemed an act of academic misconduct. If you are uncertain about plagiarism,
collusion or referencing, simply email your tutor, lecturer or unit coordinator and ask.
Marking Key
Marks are allocated as follows for this assignment. Criteria Marks
Pseudocode
These marks are awarded for submitting pseudocode/flowcharts which suitably represent the
design of your source code. Pseudocode and flowcharts will be assessed based on does it help in
understanding/describing the structure and flow of the program?
5
Functionality
These marks are awarded for submitting source code that implements the requirements specified in
this brief. Code which is not functional or contains syntax errors will lose marks, as will failing to
implement requirements as specified.
10
Code Quality
These marks are awarded for submitting well-written source code that is efficient, well-formatted
and demonstrates a solid understanding of the concepts involved. This includes appropriate use of
commenting and adhering to best practise.
5
Total: 20
Dice Games
7/11 Each player rolls two dice. If the total rolled is 7 or 11, they win. If they roll any other number
they must reroll until they match their original number, however if they roll a 7 or 11, they lose. Their
score is the number of rolls needed to win, lowest score wins.
Odd/even Each player rolls four dice. For each odd number rolled the number is subtracted from
their total, for each even number rolled the number is added to their total. Even numbered dice can
be rerolled (once) if the player wants to try to get a higher score. The highest total wins.
Ship Dice Each player rolls six dice. They need a ship (6), a captain (1) and crew. If they have a
ship and captain in their roll, their crew (score) is the sum of all the other dice. If they do not have a
ship and captain they can roll again, keeping a ship if they have one and only rolling five dice. If on
their second roll they still have no ship and captain their score is 0. The highest score wins.
Bunco Each player rolls six dice. They score one point for each dice that matches their player
number. The first player scores one point for each dice showing a one, player two scores one point
for each dice showing a two and so on. Each player can hold one to five dice and reroll the others to
try to get a higher score. Each player only gets one reroll. The highest score wins.
Balut Each player rolls five dice. The goal is to make sets of dice, or a straight (all numbers 1 to 5 or
2 to 6). Highest scoring set wins. Hands are ranked as follows: five of the same number, straight, four
of the same number, three of the same number, two of the same number, or highest number.
Cee-lo First a random sequence of three dice is rolled. Then each player rolls three dice, trying to
match the random sequence. They may choose how many of their dice they want to reroll, to try to
better their match. Points are scored for how many dice match the sequence.
Spider The goal is to be the first to draw a spider. Each player rolls one dice at a time, if they roll a 6
they draw the body of the spider ( ). Once they have drawn the body if they roll a 3 or 4, they can
draw a leg, or a 1 to draw an eye. Their score is how many rolls are required to complete the spider;
however, they must draw the body (6) before adding to the body.
//\(oo)/\\
Zilch Each player rolls six dice. They score points based on what they roll. A one scores 100 points,
five 50 points, three of the same number is the number x 100 (1000 points for three ones). However,
they can reroll any dice they like trying to get a better score. If they do not score in a roll their points
are scored and the next player rolls. If a player scores all six dice, they continue to roll adding to their
score.
Over 12 Each player rolls a single dice and can choose to roll again (and again) if they choose. Their
total is the sum of all their rolls. The target is 12, if they go over twelve, they score zero. Once a
player decides to stay the next player takes their turn.
Midnight Each player rolls six dice to begin. The player must keep at least one, the rest are rerolled.
This is repeated until all the dice have been kept. The player must keep a one and a four at some
point and if they do their score is the sum of the remaining dice. If they do not have a one and a four
in their final set, they score zero.
Pig Each player rolls a single die until either a one is rolled, or they decide to hold. Their score is the
sum of all the numbers rolled, unless they roll a one in which case their score is zero.
Petals around the rose Each player rolls three dice. Their score is determined by the number of
petals around the rose. Considering the rose being the centre pip on the die; a five scores four points
and a three scores two points. If the player has rolled at least one rose (1, 3 or 5) they can choose to
reroll all dice to try to get a better score.
Mexico – is another fun dice game with simple dynamics. The game is played with two dice for
rolling, with each player being given an additional die. The die will dictate how many lives each
player has after each round, so will start on a six, and deplete accordingly. After each game, the
lowest dice roll will be considered the losing roll, and as such, that player will lose a life. The winner
of Mexico is the player left standing after all players have rolled their dice and lost their lives.
Shut the Box – Generally played within a wooden box that displays the current numbers, each player
will roll dice and use the combinations made to reach one of the numbers displayed on the wooden
display. As each number is matched, the numbers within the wooden display will be flipped over. If
the number 1 is the only number left showing, then players will only need to roll one dice in the
hope they can reach the final number. Once a player can successfully match all the numbers, they are
declared the winner, thus having to shut the box as a result.
Yahtzee – Each player in turn places all 5 dice in the cup, shakes the cup and rolls out the dice. Each
turn consists of a maximum of three rolls. The first roll must be made with all five dice. If the player
chooses to roll a second and, if desired, a third time, he may pick up any or all the dice and roll again.
It is the skilful use of these two optional rolls of the dice that can turn an unlucky first or second roll
into a high-scoring turn. A score must be entered after the last roll in the appropriate box or a zero
entered in a box of the player’s choice. Each player keeps his own score on a YAHTZEE score card to
be marked with the player’s name.
You can find expanded and complete rules for dice games on the internet. Some have been simplified
here to make the task easier.