C++编程调试、讲解MCD4720程序、辅导c/c++设计程序

- 首页 >> Python编程
Foundations of C++
Assignments 2 and 3 – Mastermind
MCD4720 - Fundamentals of C++
Assignment 2 and 3 - Trimester 1, 2021
Assignment Submissions
This project will be submitted in two parts. Both parts of the assessment are equally important for
the successful completion of your project, so it is essential that you understand the requirements
of both parts before you start.
 Assignment 2: Mastermind (Part A: Project Plan)
Due Date: April 9, April 12, 2021, 11:55PM (Week 6 7)
Marks: This assignment will be marked out of 100 points.
Weighting: 10% of your final mark for the unit.
This assignment is the first part of a larger project, which you will complete in Assignment
3. This task consists of your project planning documentation. It will include details of the
requirements & analysis of your program, including UML Class diagrams.
The purpose of this assignment is to get you comfortable with planning a C++ programming
project for Assignment 3. The task is detailed later in this assignment specification, as are
the specific marks allocation.
 Assignment 3: Mastermind (Part B: C++ Project Implementation)
Due Date: May 3, 2021, 11:55PM (Week 10)
Marks: This assignment will be marked out of 100 points.
Weighting: 20% of your final mark for the unit.
This assignment consists of your implementation of your project, as outlined in your Project
Planning document (Assignment 2).
Your project must follow your project plan and must be submitted as a Visual Studio project,
including all header and .cpp files, and any appropriate text files to ensure the program
compiles and runs.
This assignment consists of one Application file and associated custom Class files. The
purpose of this assignment is to get you comfortable with designing and implementing basic
multi-class C++ programs. The task is detailed later in this assignment specification, as are
the specific marks allocation.
2
Foundations of C++
Assignments 2 and 3 – Mastermind
Late submission:
• By submitting a Special Consideration Form or visit this link:
https://lms.monashcollege.edu.au/course/view.php?id=1331
• Or, without special consideration, you lose 5 marks of your mark per day that you submit late (including
weekends). Submissions will not be accepted more than 5 days late. This means that if you got Y marks,
only Y-n*5 will be counted where n is the number of days you submit late.
• Assessment items will not be accepted after more than 14 calendar days unless a Special Consideration
application has been approved. This 14-day time frame does not apply to assessments due in Week 12.
Marks: This assignment will be marked out of 100 points, and count for 10% of your total unit marks.
Plagiarism: It is an academic requirement that the work you submit be original. If there is any evidence of copying
(including from online sources without proper attribution), collaboration, pasting from websites or textbooks, Zero
marks may be awarded for the whole assignment, the unit or you may be suspended or excluded from your course.
Monash Colleges policies on plagiarism, collusion, and cheating are available here or see this link:
https://www.monashcollege.edu.au/__data/assets/pdf_file/0010/17101/dip-assessment-policy.pdf
Further Note: When you are asked to use Internet resources to answer a question, this does not mean copy-pasting
text from websites. Write answers in your own words such that your understanding of the answer is evident.
Acknowledge any sources by citing them.
3
Foundations of C++
Assignments 2 and 3 – Mastermind
Submission Instructions:
This project will be submitted in two parts:
 Assignment 2 – Part A: consists of your project planning documentation.
This document will include an outline of your program structure and UML Class diagrams.
The assignment must be created and submitted as a single Word or PDF document to the
Moodle site. This document must clearly identify both your Name and Student ID to facilitate
ease of assessment and feedback.
Your document file MUST be named as follows:
“YourFistNameLastName_A2.docx” or “YourFistNameLastName_A2.pdf”.
This file must be submitted via the Moodle assignment submission page.
The document should contain the project plan and the UML diagrams. You can use Microsoft
Visio to draw the UML diagrams or you can use any other software, provided that the
diagrams are included in your submitted document.
Explicit assessment criteria are provided, however please note you will also be assessed on
the following broad criteria:
✓ Detail of a proposed project plan for the overall project.
✓ Creating accurate and complete UML diagrams.
✓ Applying a solid Object-Oriented Design (OOD) for the overall project
✓ Using appropriate naming conventions, following the unit Programming Style Guide.
 Assignment 3 – Part B: consists of your implementation of your game project.
Your project must follow your project plan and must be submitted as a Visual Studio project,
including all header and code files, and any appropriate text files to ensure the program
compiles and runs.
You may complete the tasks in your preferred IDE, however you MUST create a Visual
Studio project in order to submit. Your project folder must be identified by using your name
and assignment number, such as YourFirstNameLastNameID_A3.
The entire project folder must then be zipped up into one zip file for submission. The zip file
MUST be named “YourFistNameLastName_A3.zip”. This zip file must be submitted via the
Moodle assignment submission page.
Explicit assessment criteria are provided, however please note you will also be assessed on
the following broad criteria:
✓ Meeting functional requirements as described in the assignment description
✓ Demonstrating a solid understanding of C++ concepts, including good practice
✓ Demonstrating an understanding of specific C++ concepts relating to the assignment
tasks, including object-oriented design and implementation and the use of Pointers
✓ Following the unit Programming Style Guide
✓ Creating solutions that are as efficient and extensible as possible
✓ Reflecting on the appropriateness of your implemented design and meeting functional
requirements as described in the assignment description
4
Foundations of C++
Assignments 2 and 3 – Mastermind
NOTE! Your submitted program MUST compile and run. Any submission that
does not compile will automatically awarded a 50 marks penalty. This
means it is your responsibility to continually compile and test your
code as you build it.
NOTE! Your submitted files must be correctly identified and submitted
(as described above). Any submission that does not comply will receive
an automatic 20 marks penalty (applied after marking). For assignment 3,
your Visual Studio project should include all .cpp and .h files.
If you have any questions or concerns please contact your tutor as soon as possible.
5
Foundations of C++
Assignments 2 and 3 – Mastermind
Assignment 2: Master Mind (Part A)
You are to implement a computer-based variant of the board game Master Mind. This is a twoplayer
deduction game played with a specialised game board in which the aim of the game is to
break the hidden code in the fewest number of moves.
You can watch a video on how to play here: https://www.youtube.com/watch?v=ZSXpmIH-_d4 or
read this article: https://www.wikihow.com/Play-Mastermind or even play an online version here:
http://www.webgamesonline.com/mastermind/.
In your version, you will be the code breaker, playing against the computer who is the code maker.
For Part A of the assignment you will focus on the planning of the project. In Part B you will focus
on creating the various interactive objects in the game and program the player interactions.
Basic Game Play
First, the code maker selects any 4 coloured pegs (from 8 different
colours) in any combination to create the hidden code.
The code breaker now attempts to determine the hidden code by
selecting 4 coloured pegs at a time, and placing them in the order they
think matches the hidden code.
After each guess, the code maker gives clues – a black peg for the
correct colour in the correct position, a white peg for the correct colour
but in the wrong position, leaving empty slots if the colours are not in
the code.
The code breaker must guess the code in 10 turns or less, otherwise
they lose the game.
In your version you can use words, letters, numbers or symbols for the
code.
Human Player:
You, as the human player, must be able to input your choices for the hidden code as required by
the program. For example: if the program uses numbers for the code then you must enter 4
numbers as your guess. After you enter your guess, the board will update, showing you the
accuracy of your guess. You continue until you have cracked the code (you win) or you have run
out of turns (you lose).
Computer Player:
Obviously, you as a player can make strategic choices as to which colours to use when guessing
the hidden code. However, programming the computer breaking the code is beyond the scope of
this assignment. Therefore, the computer will be assigned the role of code maker and the player
will be the code breaker (see Assignment 3 brief for more details on this).
6
Foundations of C++
Assignments 2 and 3 – Mastermind
Project Plan
Having a clear plan for your project before you begin coding is essential for finishing a successful
project on time and with minimal stress. So part of this assignment is defining what will be in your
project and what you need to do to actually develop it.
Important: You must also read the requirements for Assignment 3 in order to be able to
complete the documentation required for Assignment 2.
The documentation you must submit will include the following:
✓ A description of “How to Play”
This will be the information you display on the opening screen of your game to inform the player
what they need to do in order to play and win the game. Do not just copy the game play
description above, make your own description.
Note: This description must be saved as a text file and read into your game when the program
begins. You can also use this as a convenient way to display “help” if the player asks for it.
✓ A development outline of your game
Using a simple outline format (numbered or bullet points) state the main actions that the
program will have and then, as sub-points, state the things you will need to do to make that
happen.
The outline structure should contain all the elements of your game, as this is a high level
description of your approach to the development of your program. You should include at least
the following headings and provide examples of happens under each section.
 The game setup (everything that happens before the game starts)
 The player’s turn (the sequence of events that happen during a turn)
 Processing player input (include each of the commands your player can use)
 Providing feedback to the player (in response to the player’s interactions)
 The end game conditions (include all win and lose conditions)
 Additional Features included, if any – see Assignment 3
 Outline the functionality of all your game classes – see Assignment 3
Here is an example to get you started with your project outline:
o The Game Setup
 Display an overview of the game rule so the player knows what to do to win.
▪ read this information from a text file
 Initialise the game elements:
▪ add the player – ask for the player’s name, set default variables
▪ all the other things that will happen during initialisation including
• creating the game board
• initialising other game variables (list them here)
As you can see, you only have to describe the actions the program will take, not the code, for
the outline. The idea here is to give you a starting point for when you start writing your code as
you can use this as a checklist of the things you need to include.
✓ UML Diagrams
UML diagrams are designed to make structuring your program easier.
How to create them will be covered in class, but the general structure is
shown here – see Assignment 3 for more details about classes.
You will need UML diagrams for each of the classes you include in your
game – at least a Player, Board and Application (main) class.
ClassName
list of attributes
(variables)
list of behaviours
(functions)
7
Foundations of C++
Assignments 2 and 3 – Mastermind
Assignment 2: Marking Criteria [100 marks in total]
1. Requirements and Analysis Document (Project Plan) [80]
1.1. Description of the rules (the introduction to your game) [8]
1.2. Outline includes all game functionality (from Part B) [12]
1.3. Each section is broken into logical tasks [15]
1.4. Tasks are performed in a logical order [15]
1.5. Task descriptions given provide sufficient detail [30]
2. UML Diagrams [20]
2.1. Correct structure used (Name, Attributes, Behaviours) [4]
2.2. Included the correct designations for public (+) and private (-) data [8]
2.3. All variables and functions have meaningful names [8]
Assignment 3: Master Mind (Part B)
You are to implement the Master Mind game you started in Assignment 2 by creating a Visual
Studio Project using your project plan as described in your previous submission.
Your completed Master Mind game must demonstrate the following:
✓ You MUST implement your program using the following classes, as a minimum, you may
include more (as appropriate for your game design):
 Player class: holds a player’s details including their name, score, wins and the number
of games played.
 Board class: holds the current game’s details including each of the player’s previous
moves and associated clues, the number of rows and columns used in the game.
 Application file: holds the main() function and controls the overall flow of the game.
You may include other relevant attributes and behaviours to these classes, as identified in
your project plan.
✓ The Player must be able to do the following:
 assign a name which is requested at the start of the game and used in the feedback given
 see all their previous moves at the start of their turn so they can make an informed choice
 type in a code, using either letters or numbers and seeing appropriate feedback on the
accuracy of their input
 continue typing in codes and seeing feedback until they either “crack the code” or run out
of turns
 quit the game at any time – during or after a game
✓ The Board in the game should have the following characteristics:
 a defined number of columns (code slots) and rows (the maximum turns a player has)
 be able to display each code entered and given feedback as a specific row
 be able to reset the board to empty at the end of a game
 not be able to add any more rows beyond the specified number
8
Foundations of C++
Assignments 2 and 3 – Mastermind
✓ The Game Application must do the following:
 display the “how to play” information at the start of the game
 create or select a secret code – using words/letters, symbols and/or numbers
 display an appropriate and uncluttered user interface providing relevant information to the
player at all times
 ask for and allow the player enter a code
 compare the player’s code to the secret code and provide appropriate feedback to the
player (a symbol for a correct letter/number in the correct position and a different symbol
for a correct letter/number but in the wrong position, it is optional to use another symbol
if the letter/number is not in the code)
 display the updated game board after each code entered by the player
 terminate the game (player wins) when the player has guessed the code
 terminate the game (player loses) when the player has run out of turns
 provide player stats at the end of the game (wins, loses and score)
 the player should be able to QUIT the game at any time
Program Reflection
You must also provide a 300-word written reflection of your object-oriented design and how well
you believe it was to implement. You should cover the following areas:
 Discuss why you designed it the way you did.
▪ Why did you create your classes that way?
▪ How does this reflect an OO design or approach?
 Discuss how well you were able to code it
▪ Highlight any issues you found once you tried to implement your design.
▪ How did you resolve these issues?
 If you were to do this project again, discuss how you might change your design to make your
solution easier to implement, more efficient, or better for code reuse.
This must be a Word or PDF document which must be included in the same folder as your *.sln
file. Your document file MUST be named as follows:
“YourFistNameLastName_A3.docx” or “YourFistNameLastName_A3.pdf”.
Extra Functionality
The marking criteria indicates that you should make some individual additions to this in order to
achieve the final 20% of the mark.
Following is a list of additional features you can include, with the maximum number of marks [x]
you can earn for each one. You may implement one or more features from the list, but you will
only score up to the maximum of 20% of the total assignment marks or 20 marks.
You should aim to add some additional creative elements to the gameplay, as well as advanced
object-oriented design elements or advanced use of pointers.
 Add a theme to the game which is incorporated into the game play through the story and
the feedback given (for example: Word Detective, Number Cruncher, etc.) [2]
 The player can select a skill level [eg: Novice (Detective), Thinker (Inspector) and Master
Mind (Chief Inspector)] which modifies the game parameters – the number of elements in
the code and the number of rows (turns) the player has to solve it. For example: easy has 4
9
Foundations of C++
Assignments 2 and 3 – Mastermind
elements out of 6 with 10 rows, tricky has 5 elements out of 8 with 12 rows and hard has 6
elements out of 10 with 14 rows. [4]
 Implement an appropriate scoring system based on the game parameters – number of turns
taken, a bonus for unused rows, +/- point based on a win or a loss, etc. [3]
 Read in word and/or element lists from a file (based on word length, such as 4-, 5- and 6-
letter words, numbers or symbols) and store appropriately. Word lists should have at least
20+ words of each length. The list used in the game could be linked to a player skill level
and/or randomly selected at the start of each game. To help you a text file (jotto.txt) has
been given, you can find it on Moodle. [6]
 Give the player additional options apart from just typing the code or quitting the game. This
could include options to: ask for help (displays an information screen loaded from a file), ask
for a hint (displays a random element from the secret code and must be a limited option),
ask to resign from the current game but not quit the entire game (ends the current game as
if the player ran out of turns and displays the secret code). [4]
 Display the board using ASCII art. [4]
 Allow the game to be saved and restored at the player’s request. [4]
 Allow the player to select what elements will be used in the code (numbers, symbols, letters,
words). Words should range from 4- to 6-letter words, while a specific range of numbers or
set of letters/symbols should be clearly identified and displayed to the player. The feedback
symbols can remain the same, you can use (jotto.txt). [5]
 Ask the player if they want to be promoted to the next skill level after winning 5 games. If
they accept their skill level is increased by one (to the maximum level permitted in your
game). Also, if the player loses 5 games in a row they are automatically demoted one skill
level (to the minimum level permitted in your game). [5]
 Implement a more sophisticated computer player. The computer player should be able to
have its own Player object (including name and any other player stats as required for your
game), and score the points the human player would lose plus earn a suitable bonus for the
win. It should also make intelligent choices for words/letters, symbols or numbers including
using doubles or triples of the same letter/symbol/number. It should also have the ability to
give random comments to the player based on how well (or not) the player is doing. [10]
You certainly do not have to implement all of the above to earn marks for extra functionality. Just
remember the maximum number of marks you can earn are given in [x]. It is up to you!
10
Foundations of C++
Assignments 2 and 3 – Mastermind
Assignment 3: Marking Criteria [up to 100 marks in total]
Does the program compile and run? Yes or No
 50 marks penalty will be applied for a non-compiling program.
1. Class Design [15]
1.1. Player Class [5]
1.1.1. Has an appropriate header file [2]
1.1.2. Required data members and member functions using meaningful names [1]
1.1.3. Contains only aspects that relate to a “player” (has no data members or member functions that
are not directly related to a Player) [2]
1.2. Board Class [5]
1.2.1. Has an appropriate header file [2]
1.2.2. Required data members and member functions using meaningful names [1]
1.2.3. Contains only aspects that relate to a “board” (has no data members or member functions that
are not directly related to the board) [2]
1.3. Game Application [5]
1.3.1. Has an appropriate header file [2]
1.3.2. Has appropriate variables and functions using meaningful names [2]
1.3.3. The main() function has appropriate function calls to keep it uncluttered [1]
2. Functionality [35]
2.1. Game set up including: displaying “how to play” information, initialising the player and game
variables, creating the secret code using appropriate data, etc. [5]
2.2. Implementation of a clear and uncluttered User Interface display [5]
2.3. Successful implementation of action processes [5]
2.4. Successful implementation of calculating and displaying the correct clues [5]
2.5. Appropriate feedback to player’s interactions [5]
2.6. Appropriate feedback displayed to the player [5]
2.7. Appropriate end game conditions triggered [5]
3. Quality of Solution and Code [20]
3.1. Does the program perform the functionality in an efficient and extensible manner? [12]
3.1.1. Appropriate use of functions and function calls [1]
3.1.2. Appropriate use of data types [1]
3.1.3. Appropriate use of decisions, loops and other programming techniques [2]
3.1.4. Appropriate use of references and/or pointers [5]
3.1.5. Appropriate use of good programming practices and techniques [2]
3.1.6. Extraneous and redundant code removed [1]
3.2. Has a well-designed OO program been implemented? [4]
3.2.1. Contains classes appropriate to the assignment brief [3]
3.2.2. Program structures support and OO design [1]
11
Foundations of C++
Assignments 2 and 3 – Mastermind
3.3. Has the Programming Style Guide been followed appropriately? [4]
3.3.1. Appropriate commenting and code documentation [2]
3.3.2. Correct formatting of code within *.h and *.cpp files [2]
4. Extra Functionality [maximum 20]
4.1. Incorporate a theme into the story and feedback given to the player [2]
4.2. Implement difficulty levels which may be selected by the player [4]
4.3. Implement an appropriate scoring system based on game parameters [3]
4.4. Read word lists from a file and store appropriately [3]
4.5. Player has additional command choices [4]
4.6. Display the board using ASCII art [4]
4.7. Allow the game to be saved and restored at the player’s request [4]
4.8. Allow player to select which elements to use [5]
4.9. Player promotion/demotion every 5 games won/lost [5]
4.10. Implement a more sophisticated computer player [10]
5. Reflection [10]
5.1. Discussion of motivations for the program design [3]
5.2. Discussion of how well the design was to implement [3]
5.3. Discussion of what they would do differently if they were to start it again [4]
Assignment Notes:
It is your responsibility to know what is expected of you. If you are unsure about anything, ask
your tutor sooner rather than later. Write any questions and/or notes here to help you clarify what
you have to do.
Note: Your tutor may ask you to program part of your assignment in class
to determine that you have completed the work yourself. Failure to do this
to an acceptable level will result in you being referred to the Subject
Leader for plagiarism.
In-Class interviews: Also, you may be required to demonstrate your code
to your tutor after the submission deadline. Failure to demonstrate will
lead to zero marks being awarded to the entire assignment.
Note: Submitting only .sln file, a zero mark will be granted.
12
Foundations of C++
Assignments 2 and 3 – Mastermind
Here are some sample screen shots to help you develop your user interface:
13
Foundations of C++
Assignments 2 and 3 – Mastermind

站长地图