100 |
|
98 |
97 |
96 |
95 |
94 |
93 |
92 |
91 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
|
|
90 |
80 |
78 |
77 |
|
75 |
74 |
73 |
7體 |
71 |
|
61 |
58 |
54 57 |
65 |
|
67 |
68 |
69 |
70 |
|
60 |
59 |
56955 |
|
53 |
52 51 |
||||
41 |
42 |
|
44 |
45 |
46 |
|
8 |
49 |
50 |
|
39 |
38 |
|
36 |
35 |
|
33 |
32 |
31 |
21 |
22 |
23 |
24 |
25 |
26 |
14 |
28 |
29 |
30 |
20 19 |
|
6 |
15 22) |
13 |
12 |
11 |
|||
|
2 |
|
|
5 |
7 |
8 |
9 |
10 |
Introduction
“Snakes and Ladders”is a board game for two or more players taking turns rolling dice,the winner is the player who reaches the final square on the game board at the earliest.For more information see:https://en.wikipedia.org/wiki/Snakes and ladders. You have been pro- vided some starter code which allows you to play “Snakes and Ladders”.The assignment is to finish the provided task mentioned next using what you have learned during the course using C Programming Language.
Tasks
In this section the tasks you need to perform for the assignment is listed.
Task 01 - Dice Rolling
- Changethecode so that a player rolls two dice.
- Ifa player rolls double sixes (6 on both dice), then they receive another turn and roll the dice again.
- If theplayer is close to the finish (within 6 squares of finishing), then the player will only roll one dice.
Task 02 - Players
- Add functionality for at leasta third player to join the game. You can add options to have more than three players.
- Iftwo or more players are in the same box, display on the board that all the players are on the same box.
Task 03 - Playing Grid
- Theprovidedstarter code already shows the positions of the players on the grid, augment the code to show the positions of the snakes and ladders on the grid also. If a player lands on a snake print "Oh no! You have landed on a snake and fallen back from square X to square Y". Similarly, if they land on a ladder then they will receive a message "Hooray! You have landed on a ladder and climbed from square X up to square Y!".
- Makesurethat each new game randomly generates new set of snakes and ladders (new games don’t have the same snakes and ladders).
- Ask theuserin the game menu to specify the size of the board they wish to use and create such a board (8x8, 10x10, 12x12). The user will also provide the number of snakes and ladders they wish the board to have.
- Avoidsnakeand ladder conflicts. Ensure that snakes and ladders do not cover the same squares (i.e. a square cannot have a ladder and a snake.).
(a) The head of the snake should always take the player to a lower number to the tail of the snake.
(b) The head and the tail of the snake should not be in the same row.
(c) The bottom part of a ladder should always take the player to the top part of the ladder.
(d) The top and the bottom part of a ladder should not be on the same row.
(e) The box where the top part of a ladder is, should not contain a snake’shead.
(f) The box where the tail part of the snake is, should not have a bottom part of a ladder. (Hint: Select different rows randomly first, and then select columns randomly.)
Player 1 is now at square 37.
100 |
99 |
98 |
97 |
96 |
95 |
94 |
93 |
92 |
91 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
80 |
79 |
78 |
77 |
76 |
75 |
74 |
73 |
72 |
71 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
60 |
59 |
58 |
57 |
56 |
55 |
54 |
53 |
52 |
51 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
40 |
[#P2] |
38 |
[#P1] |
36 |
35 |
34 |
33 |
32 |
31 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
Figure 1:A sample board from the starter code for"Snakes and Ladders"game.
Task 04 -Extra Functionality
1.You need to add an interesting,extra piece of functionality which will make your game unique.Here are some ideas which may be interesting (not necessarily you have to imple ment the below,you can think your own)
(a)Once a game ends,you can save the generated board on a file.
(b)Option to save a game on a file in the middle of a game,and later load it to continue the game.
(c)Keep a count which player wins in how many turns.
(d)Be creative!
Don't limit yourself with the above ideas only!
Assessment
This section gives the submission requirements and a breakdown of the approximate marking criteria for the assignment.The final marking scheme may vary slightly but will be relatively similar.
Submission Format
The completed project should be submitted as a zip file and must contain the source files (.c or h)associated with the project.A starter code has been provided with the file name代寫COMP1001J Playing Grid StartingCode.c,which you can download from csmoodle.
Marking Scheme
The marking scheme shown in Tableis indicative only.This means that it may be changed at any time without notice.However,it will have approximately the same criteria.Criterion mayTable 1: Marking Scheme Guidelines
Item Fail Pass Excellent |
|||
Design Not using any functions at all, code is written as one big list of instructions. |
Some use of functions, but large functions with unorganised, or repeated codes, or have other prob- lems. |
Excellent use of func- tions to break the prob- lem down into manage- able and modular chunks. |
|
Global Variables |
Almost all variables are global. |
There are only a few global variables in the program. |
There are no global vari- ables in the program. |
Display Board does not show properly. |
Board shown, but there are some issues with the formatting and alignment. |
Board is perfectly drawn, formatted and aligned, with the players displayed clearly. |
|
Menu No menu, or menu work- ing correctly. |
Menu works correctly, but has some problems, or if doesn’t coverall options. |
Menu is well designed and easy to use for the players. |
|
Task 01 None of the three sub- tasks are complete, or if none of them work. |
Task 1.1 and Task 1.2 are successfully complete. |
All of the tasks are com- plete. |
|
Task 02 None of the two sub-tasks are complete, or if none of them work. |
Task 2.1 is successfully complete with at least three players. |
Task 2.1 and 2.2 are com- plete with at least three players |
|
Task 03 If none of the sub-tasks are complete or they does not work correctly. |
Task 3.1, 3.2, 3.3 are im- plemented. Some of Task 3.4 works, but have prob- lems. |
If all the sub-tasks are implemented perfectly. Proper limit checking for inputs. |
|
Task 04 |
There are no specifications here. try to implement something which is unique and differentiates your game from the others. You will be graded based on if your unique feature works as intended. |
be removed and additional criterion may be added. It can however be used as a guide to the level required for the different parts of the assignment.
Additional ConsiderationsAlong with the criteria mentioned above, the following will also be considered when the grades will be calculated:
- Names:Variables and functions should be named sensibly (if the purpose of the function or the variable is not understandable from the names, then it has not been named well).
- CodeFormatting:Code shod be well formatted and indented correctly.
- Comments:Youcode shouldbe lightly (not too much text) but precisely documented.