Reference no: EM132680678
DiceGame
Instructions to Students
1. This assignment is an individual assignment and should be done on you own only. Plagiarism will be treated seriously. Any submitted assignment is found that involved wholly or partly in plagiarism (no matter the assignments are from the original authors or from the plagiarists) will be scored Zero mark and the students involved will be received discipline penalty set by the institute accordingly.
2. Grading of your programs will be based on correctness, quality, style and efficiency.
3. Late submission will NOT be accepted.
4. Each student may be arranged to conduct an interview with your lecturer to explain some parts of your program code and answer some questions. Marks will be deducted if you cannot explain your code well.
5. A non-compliable java program will results in NO marks.
Assignment Specification
You are asked to write a Dice Game using Java.
Rule of the game
1. When the program runs, there is a track with length 71 cells created for both the Player and CPU.
2. The first cell is indexed as 0 and the last step is indexed as 70.
3. Both the Player1 and CPU start at position 0.
4. Player 1 and CPU take turns to throw the dice, range from 1-6. Player1 always goes first.
5. Player1 / CPU go forward base on the number of rolled steps.
6. Whoever came first to cell 70 wins the game.
Feature - Teleport
1. Some cells on the track are given a chance to teleport to another cell directly. For example, if player step on cell 4, it will be teleported to cell 68.
2. The teleport graph is stored in an integer array with 71 elements.
static int[] teleport = {-1, -1, -1, -1, 68, -1, -1, -1, -1, -1,
-1, -1, -1, 40, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 38, -1, -1,
-1, -1, 2, -1, -1, 63, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 29 - 1, -1, -1,
-1, -1, -1, -1, -1, -1, 53, -1, -1, -1,
65, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1};
3. Copy the above array to your program code.
4. On the track, if there is a teleport chance moving forward, it is shown as ">", for moving backward, it is shown as "<".
5. Negative one (-1) in the array means there is no teleport chance on that cell.
6. You track should be like this at the very beginning of the game.
7. DO NOT hard code the track appearance, you should do it in a programmatic way. You should assume the developer may modify the track JUST BY modifying the teleport array.
Attachment:- DiceGame.rar