C++代写 | IT114107/ITP4704M Data Structures Assignment

Hong Kong Institute of Vocational Education
Department of Information Technology
HD in Game Software Development (IT114107) ITP4704M C++ Programming and Data Structures Assignment
Assignment Due Date and Time
8 July 2019 (Mon) 9:00 am (via moodle)
Assignment Specification
This assignment is to implement a game using Object-Oriented Programming and Data Structure Techniques. In this game, the player controls a snake moving around the board, with food appearing randomly from time to time. The snake can eat the food to grow and get marks. The food is represented on the board as brackets and quote symbols. The snake can only digest the food when it matches the one on top of its stomach stack. Extra marks will be awarded to the player when the food is paired up and digested.
The Game Board and the Initial Position of Snake
The game board can be presented in either way below:
+———-+ |ooO | || || || || || || || || || +———-+
ooO……. ………. ………. ………. ………. ………. ………. ………. ………. ……….
It is a 10 x 10 game board and “o” is used to represent the snake body and “O” is used to represent the head of snake. The initial position is shown as above.
1

The food and the way to generate food
There are 8 kinds of food, as listed below:
[ ]{}()”‘
Food is randomly generated, and the frequency is shown as below:
1st – 10th food: 11th – 20th food: the food after:
appear every 3 moves (starting right after the first move) appear every 2 moves
appear every 1 move
Food is randomly placed in any free space on the board (i.e. not occupied by the snake and any food). When there is no more space on the board, it will stop generating the food until there is free space on the board again.
The snake
As shown in the Game Board section, the snake size is initially three. It can move around by using WASD, where W is up, A is left, S is down and D is right. The movement controls the head’s next position and the body follow, i.e. the tail position will be updated to the second last position. The following is an example of moving down:
———- |oo| |O| || |[| || || || || || || ———-
.oo……. ..O……. ………. ..[……. ………. ………. ………. ………. ………. ……….
2

The above example also shows how a food is generated. If the snake keeps going down and eat the food,
———- |o| |o| |O| |[| || || || || || || ———-
..o……. ..o……. ..O……. ..[……. ………. ………. ………. ………. ………. ……….
The length of the snake will increase:
———- |o| |o| |o| |O| || || || || || || ———-
..o……. ..o……. ..o……. ..O……. ………. ………. ………. ………. ………. ……….
And in this case, the position of tail remains unchanged and the length of the snake is increased by 1.
The stomach of the snake is a stack of size 5. The food just eaten by the snake is pushed to the top of the stack and kept there. Only the foods at the top of the stack can be digested, and this is done by eating a food which matched with the top element. Following is the matching table
Top of the stack
Matching food
[
]
]
n/a
{
}
}
n/a
(
)
)
n/a




Therefore, the snake should avoid eating close bracket like ] } ) before open bracket like [ { (.
3

When a pair matched foods is eaten, the food just eaten will not be added to the stomach and the food at the top of the stomach will be removed (popped). In other words, the space in the stomach increases by 1.
Every single move of the snake has 1 mark, every eaten food will add extra 3 marks, every pair of quotes digested has 5 extra marks and every pair of brackets digested has 8 extra marks.
Game over
Like every living thing, the snake ends up being dead. The following scenarios will lead to the snake’s dead:
1. The snake eats a food when its stomach stack is full;
2. The snake hits on the wall (the edge of the game board); and 3. The snake hits on itself, i.e. hit on any part of its body.
Sample User Interface
Mark: 76
Step: 37
Size: 9
Stomach Stack (3/5): [ { ” _ _
from bottom to top
———- |”| |ooo }| |o| |o| |oooO| || |]’| |[| |{| |}| ———-
Control the snake (a,s,d,w): d
Mark: 77
Step: 38
Size: 9
Stomach Stack (3/5): [ { ” _ _
from bottom to top
4

———- |”| |oo}| |o| |o| | ooooO” | || |]’| |[| |{| |}| ———-
Control the snake (a,s,d,w): d
Mark: 86
Step: 39
Size: 10
Stomach Stack (2/5): [ { _ _ _
from bottom to top
———- |”| |oo}| |o| |o| | oooooO | || |]’| |[| |{| |}| ———-
Control the snake (a,s,d,w): a
— Game Over —
Mark: 86
Step: 39
Size: 10
5

Technical Requirement
In this assignment, you are required to use 1 or 2-D array to model the game board. Linked List to model the snake and Stack to model snake’s stomach. Following is the mark distribution:
Linked List: Stack:
Game board: Snake movement: Food generation: Eat and Digest: Mark calculation: User Interface: Documentation:
10 marks 10 marks 10 marks 10 marks 10 marks 10 marks 10 marks 10 marks 20 marks
Documentation includes evidence of testing (10%) and explanation on how data structure is used (10%)
Instructions to Students
1. This is an End of Module Assessment and the weighting of this assignment is 50% of the Module Mark.
2. This assignment should be done by each individual student. Plagiarism will be treated seriously. All assignments that have been found involved wholly or partly in plagiarism (no matter these assignments are from the original authors or from the plagiarists) will score Zero mark.
3. You must use C++ to develop the programs.
4. You are required to hand in
4.1 Explanation on how data structure is used in your program in MS Word
4.2 Source code of all classes which should be well-commented.
4.3 The evidence of testing. Prepare a word document with several test cases showing different inputs for different situations that your
6

program may encounter and how your program responses to show the capability of your program. For each test case, states the objective of the test case, input data and expected result. You should also include screen dump for each test run as evidence.
5. Submit all your works (in a zip file) to the Moodle website (http://moodle.vtc.edu.hk) by 9:00 am, 8 July 2019 (Monday). Late submission may score ZERO mark.
6. Folders in the zip file Program
Main.cpp LinkedList.h …
Documents Data_Structure_Explanation.doc Evidence_of_Testing.doc
7


程序代写代做C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:dmxyzl003


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

发表评论