首页 > > 详细

CCN2042辅导、R编程设计辅导、讲解R、讲解Computer Programming 解析Haskell程序|调试C/C++编程

CCN2042 18-19 Semester 2 – Group Project 1
CCN2042 Computer Programming
Group Project – Cooking Game
(Due: 23:59, 18 Apr 2019 (week 12 before Easter))
Expected Learning Outcomes
familiarise themselves with at least one high level language programming environment.
develop a structured and documented computer program.
understand the fundamentals of object-oriented programming and apply it in computer
program development.
apply the computer programming techniques to solve practical problems.
Introduction
In this assignment, you are going to develop the Cooking Game, a game that runs in the
command line environment. The player needs to rapidly prepare and serve the burgers within
a time limit.
This is a group assignment. You need to form a group with 5 to 6 students and write a
Win32 Console Application program called CookGame.cpp. The requirements are listed
below.
System Requirements
R0 When the program starts, the console should display a welcome message, and then
the Game Menu of the program. User can enter the options of the corresponding
actions (see R1 to R6 below).
Welcome Message designed by your group
*** Game Menu ***
[1] Start Game
[2] Settings
[3] Burger Menus
[4] Instructions
[5] Credits
[6] Exit
*****************
Option (1 - 6):
CCN2042 18-19 Semester 2 – Group Project 2
R1 [1] Start Game
When the user inputs 1 in the Game Menu, the game starts with the current game
settings (see R2).
Initially, the order list will be shown in the console. Each order contains the following
information:
1. Type of burgers (See R1.2)
2. Cooking status (See R1.3)
3. Remaining time (in form of m’ss”)
The initial number of orders will be randomly generated, and limited to the max
number of order set in the game settings.
All the burgers’ initial status is "preparing", and the remaining time is 40 seconds
(time limit can be set in the game settings, see R2).
The initial score is 10.
A sample game starts as follow, where the order list is randomly generated:
*** Order list ***
Order #1: Cheese burger, preparing, 0’40”
Order #2: Beef burger, preparing, 0’40”
Order #3: Cheese burger, preparing, 0’40”
Order #4: mushroom burger, preparing, 0’40”
Order #5: salmon burger, preparing, 0’40”
-----------------------------------------------
Score: 10
Enter [U] for update, [Q] for Quit, or [1-5] for order:
Player can input the order number to process the order.
Player can input ‘u’ or ‘U’ to refresh the order list for updating the information (i.e.
cooking status and remaining time) of all orders.
Player can input ‘q’ or ‘Q’ to quit the current game and return to the game menu.
R1.1 Order list
The orders will be shown with the type of burgers, cooking status and the remaining
time. The order list may not be in chronological order, such as:
Order #1: Cheese burger, preparing, 0'40"
Order #2: Beef burger, cooking, 0'35"
Order #3: Cheese burger, cooking, 0'20"
Order #4: mushroom burger, ready to serve, 0'09"
Order #5: salmon burger, preparing, 0'38"
Order #6: salmon burger, preparing, 0'40" CCN2042 18-19 Semester 2 – Group Project 3
R1.2 Type of burgers
There are five types of burgers with different ingredients in a specific order and
different cooking time (in second):
Type of burgers Ingredients orders Cooking time
Cheese burger Bread, cheese, beef, lettuce, bread 10
Beef burger Bread, cheese, tomato, beef, lettuce, bread 10
Mushroom burger Bread, cheese, beef, mushroom, bread 15
Veggie burger Bread, tomato, egg, lettuce, bread 10
Salmon burger Bread, cheese, beef, salmon, bread 15
There are eight types of ingredients, symbols are shown as follow:
Ingredients Symbol Ingredients Symbol
Bread B/b Tomato T/t
Cheese C/c Mushroom M/m
Beef F/f Egg E/e
Lettuce L/l Salmon S/s
R1.3 Cooking Status
Each burger has to go through 3 statuses to complete: preparing, cooking and
ready to serve.
Status: preparing
The initial status of a burger is "preparing".
Player can input the order number to choose the order with status "preparing".
Then the “Process Order” page will be shown, for example:
*** Process Order ***
Order # : 1
Burger : Cheese Burger
Status : preparing
Remaining Time : 1'53"
Burger Ingredient List: [B]read, [C]heese, Bee[f], [L]ettuce, [B]read
Burger Key List : bcflb
Please choose [U] for update, [R] for return, or
type correct key list to start cooking:
Player can input ‘u’ or ‘U’ to refresh the remaining time of the order.
Player can input ‘r’ or ‘R’ to return to the order list.
Player needs to type the correct order of ingredient symbols as specified in R1.2. For
example, cheese burger as shown above, player needs to input: bcflbCCN2042 18-19 Semester 2 – Group Project 4
If the input is incorrect, an error message is displayed. Then the “Process Order”
page is refreshed with updated remaining time. And the player needs to input again.
If the input is correct, the system returns to the order list. The status of that order is
changed to "cooking".
Player can continue to choose other orders to process.
Status: cooking
When the burger is in the "cooking" status, the player has to wait until it is done.
Concurrently, the player can choose other order to process.
If the player chooses the order with status "cooking", message should be prompted
to the player to let him/her know that the burger is not yet done.
Each burger needs to be cooked with the cooking time specified in R1.2. For example,
cheese burger needs to be cooked for 10 seconds.
If the burger is cooked, the status of the burger will be changed from "cooking" to
"ready to serve".
Status: ready to serve
Player can choose the order with status "ready to serve".
Then the burger will be served and the order will be removed from the order list. 10
marks will be awarded.
R1.4 Time limit
There is a time limit for each order, which is the same for all types of burger and can
be set in the game settings (see R2).
The orders need to be served before the time limit is reached.
The remaining time shown in the order list will be updated every time the order list is
refreshed, e.g. player inputs ‘u’ or ‘U’ to update the order list, an order is served, or
the program returns from the “process order” page.
If the player failed to serve the burger within the time limit, the order will be removed
from the order list. 5 marks will be deducted.
R1.5 New order generation
New orders (can be more than one order) may be added to the order list whenever the
order list is refreshed, e.g. player inputs ‘u’ or ‘U’ to update the order list, an order is
served, or the program returns from the “process order” page.
New orders are generated randomly with a certain probability (upon your design). CCN2042 18-19 Semester 2 – Group Project 5
R1.6 Game rules / Scoring
When the game starts, the player will initially have 10 marks.
If the order is served on time, 10 marks will be awarded.
When the order cannot be served within the time limit, 5 marks will be deducted.
The game finishes when the score < 0. If the game finishes, the system should notice
the player, and the program returns to the Game Menu.
R1.7 Quit the game
Player can input ‘q’ or ‘Q’ in the order list page to quit the game. If this happens, the
system should prompt for player’s confirmation. If the player inputs ‘y’ or ‘Y’, the
game ends and the system returns to the Game Menu. If the player inputs ‘n’ or ‘N’,
the game continues at its current status. Other input is not acceptable and the system
should ask the player to confirm again.
R2 [2] Settings
When the user inputs 2 in the Game Menu, the console displays the Settings Menu
with current setting. User can enter the options of the corresponding actions (see R2.1
to R2.3 below).
*** Settings Menu ***
[1] Time limit [40 sec]
[2] Max number of orders [5]
[3] Return to Game Menu
*********************
Option (1 - 3):
After each setting is done, the system should remain at the Setting Menu until the user
chooses option 3 to return.
R2.1 [1] Time limit (default: 40 seconds)
When the user inputs 1 in the Settings Menu, the console displays the current game
setting of time limit for the orders, and prompts for the user input of the new value.
Note that the time limit is in the unit of second and should not be greater than 300
seconds (5 mins).
After the setting is updated, the new setting should be displayed and the system
returns to the Settings Menu. CCN2042 18-19 Semester 2 – Group Project 6
R2.2 [2] Max number of orders (default: 5 orders)
When the user inputs 2 in the Settings Menu, the console displays the current game
setting of the max number of order, and prompts for the user input of the new value.
Note that acceptable max number of order is 1 to 50.
After the setting is updated, the new setting should be displayed and the system
returns to the Settings Menu.
R2.3 [3] Return to Game Menu
When the user inputs 3 in the Settings Menu, the system returns to the Game Menu.
R3 [3] Burger Menu
When the user inputs 3 in the Game Menu, the console displays the Burger Menu.
User can enter the options of the corresponding actions (see R3.1 to R3.3 below).
**** Burger Menu *****
[1] Types of Burger
[2] Ingredient Symbols
[3] Return to Game Menu
*********************
Option (1 - 3):
After a particular information is displayed, the system should remain at the Burger
Menu until the user chooses option 3 to return.
R3.1 [1] Types of Burger
Display all types of burger, their ingredients and the cooking time (see R1.2). Then
the system returns to the Burger Menu.
R3.2 [2] Ingredient Symbols
Display all ingredients and the corresponding symbols (see R1.2). Then the system
returns to the Burger Menu.
R3.3 [3] Return to Game Menu
When the user inputs 3 in the Burgers Menu, the system returns to the Game Menu. CCN2042 18-19 Semester 2 – Group Project 7
R4 [4] Instructions
The system displays the instructions for playing the Cooking game. After displaying
the instruction, the system returns to the Game Menu.
R5 [5] Credits
The system displays the personal particulars (e.g. student name, student ID, class,
tutorial group, etc.) of the group members. After displaying the information, the
system returns to the Game Menu.
R6 [6] Exit
When the user inputs this option, the system prompts for user’s confirmation. If the
user inputs ‘y’ or ‘Y’, the program terminates. If the user inputs ‘n’ or ‘N’, the system
returns to the Game Menu. Other input is not acceptable and the system should ask
the user to confirm again.
Other General Requirements
R7 Meaningful guidelines should be printed to assist with user’s input. Whenever an
option is selected, meaningful messages should be displayed.
R8 Suitable checking on user’s input is expected. Appropriate error messages should be
printed whenever unexpected situation happens, e.g., invalid input, input out-of-range,
etc.
R9 The use of functions (in addition to main function) and classes are expected in your
program. Appropriate comments should be added in your source code file.
R10 Creativity and Critical Thinking: other features that you find useful (such as the
“intelligence of computer player”) or can enhance the user experience can also be
implemented.
Submission
Source File: Each group has to submit one source code file (i.e., CookGame.cpp) that
implements this group project.
Peer-to-peer Evaluation: Each student has to fill in and submit the peer-to-peer evaluation
form (i.e., CCN2042_P2P_Evaluation.docx) for your group. CCN2042 18-19 Semester 2 – Group Project 8
All submission should be done through Moodle by 23:59, 18 April 2019. Late submission is
subject to 20% deduction in your final marks for each day (including public holidays and
Sundays). No late submission is allowed 4 days after the due date.
Grading criteria
Aspects Percentage
Program correctness
(Follow ALL instructions, marks deduction on errors found)
70%
Program design
(Appropriate use of functions, use of class, modularity, etc.)
10%
Program standard
(Use of variable names, indentation, line spacing, clarity, comments, etc.)
5%
Algorithm design
(Use of reasonable algorithms and data structures)
5%
User-friendliness
(Clear guidelines to users, messages to users, etc.)
5%
Creativity and critical thinking
(Additional useful features)
5%
Total (Group Mark) 100% (max)
Note: the length of your program does not affect the grading of the assignment. However,
appropriate use of loops and functions are expected to avoid too many repeated codes in your
program, which contributes to the program design score of this assignment.
Individual mark is determined by both group mark (80%) and individual contribution (20%),
where individual contribution is directly proportion to the average marks given by group
members in the peer-to-peer evaluation form.
Marks deduction
Marks will be deducted if the program fails to be compiled. The deduction is from 5 to 20
marks, depending on how serious the syntax error is. Note that if the program contains
unacceptably too many serious syntax errors, your program will score 0 marks.
Syntax errors also lead to failure in the program correctness if the function cannot be tested.
So please make sure that your program can be compiled successfully before your submission. CCN2042 18-19 Semester 2 – Group Project 9
Tips
To refresh the console screen, you may use the following windows platform command
appropriately in your program:
system("cls"); // Clear everything on the screen
system("pause"); // Wait until user pressing any key to continue
To handle unexpected input error (e.g. input a character to an integer variable), you may use
the following code appropriately in your program:
cin.ignore(); // Discard the content in the input sequence
cin.clear(); // Reset the input error status to no error
** Ensure the originality of your work. Plagiarism in any form is highly prohibited. **
- End -

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!