Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

MCD4720 - Fundamentals of C++

Assignment 2 and 3 - Trimester 2, 2023

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.

w Assignment 2: Mastermind (Part A: Project Plan)

Due Date: August 11, 2023, 11:55PM (Week 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.

w 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 mark allocations.

w Assignment 3: Mastermind (Part B: C++ Project Implementation)

Due Date: September 1, 2023, 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 should follow your project plan and must be submitted as a complete CLion project and must include 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.

Late submission:

●   By submitting a -orvisit this link: https://lms.monashcollege.edu.au/course/view.php?id=1331

•   Assessments submitted after the due date will incur a penalty. Students with compassionate or compelling circumstances can apply for special consideration as per the Adjustments to Assessments Diplomas Procedure. Unless otherwise stated in the unit outline, a 10 marks penalty applies for each calendar day an assessment is submitted after the due date, including weekends. Assessment items will not be accepted after more than 7 calendar days unless a Special Consideration application has been approved. This 7-day time frame does not apply to assessments due in Week 12. For assessments due in Week 12, the unit outline will inform students of the shortened time frame in which assessments will be accepted.

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 -or see this link:Academic integrity - Monash College

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.

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:

YourFirstNameLastNameID_A2.docxor YourFirstNameLastNameID_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:

●   Details 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’s Programming Style Guide.

(Note: no coding is required in Assignment 2; however, you will still need to follow the style guides in your documentation)

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 CLion 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 then create a CLion project in order to submit. Your project folder must be identified by using your name, student ID, 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

NOTE: Your submitted program MUST compile and run. Any submission that does not compile will automatically be penalised. 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-mark penalty (applied  after marking). For assignment 3, be sure that your CLion project include all .cpp and .h files. You have to submit the whole project not only the .cpp, .h and .txt files.

NOTE: Please note that you are not permitted to use any materials that have not been covered in class without consulting your teacher. If you have received permission to include materials    not covered you must reference them. Failure to do so may result in receiving a grade of zero  for the assignment and/or being subjected to academic misconduct proceedings. It is essential to seek guidance from your teacher if you have any questions regarding the use of additional materials.

If you have any questions or concerns, please contact your tutor as soon as possible.

Assignment 2: MasterMind (Part A)

You are to implement a computer-based variant of the board game Master Mind. This is a two- player 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).

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 gameplay description above, make your own version of this 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 elements of your game. 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 what 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 players’ interactions)

The end game conditions (include all win and lose conditions)

⬥  Outline the functionality of all your game classes – see Assignment 3

Additional features included, if any – see Assignment 3 Extra Functionality

Here is an example to get you started with your project outline:

⬥  The Game Setup

.   Display an overview of the game rule so the player knows what to do to win.

o read this information from a text file.

.   Initialise the game elements:

o add the player – ask for the player’s name, set default variables

o all the other things that will happen during initialisation including

●   creating the elements of the game

●   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.


ClassName

list of attributes

(variables)

list of behaviours

(functions)

Assignment 2: Marking Criteria [100 marks in total]

1. Requirements and Analysis Document (Project Plan) [60]

1.1.    Description of the rules (the introduction to your game) [10]

1.1.1.   Description of how to play the game [5]

1.1.2.   Clear description of all the rules [5]

1.2.    A development outline of your game contains all the elements (from Part B) [35] 1.2.1.  The game setup (everything that happens before the game starts) [5]

1.2.2.  The player’s turn (the sequence of events that happen during a turn) [5]

1.2.3.   Processing player input (include each of the commands your player can use) [5]

1.2.4.   Providing feedback to the player (in response to the player’s interactions) [5]

1.2.5.   Calculate the points for each player and show the winner [5]

1.2.6.  The end game conditions (include all win and lose conditions) [5] 1.2.7.  Additional Features included, if any – see Assignment 3 [5]

1.3.     Structure and formatting [15]

1.3.1.   Each element of game outline is broken down into sub tasks [5]

1.3.2.  The tasks are explained in correct program flow [5]

1.3.3.  Task descriptions given provide sufficient detail [5]

2. UML Diagrams [30]

2.2.     Included the correct designations for public (+) and private (-) data [10]

2.3.    All variables and functions have meaningful names [10]

3. Report Structure [10]

3.2.     References and in text citations [2]

3.3.     Grammar punctuation and spelling [2]

3.4.     Overall structure (layout), presentation and formatting [3]

Assignment 3: MasterMind (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 MasterMind 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):

w Player class: holds a player’s details including their name, score, wins and the number of games played.

w 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.

w 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.

Task 1: Create and Display a Menu

Your initial task is to implement a menu system that will be displayed to the user. Below is an example of how the menu should appear. In this example, option [1] has been selected,

To accomplish this, create a function called runMenu() and call it from the main() function.    Inside the runMenu() function, ensure that the user can select any of the displayed options as often as they desire before ultimately ending the program. It is important to validate the user's    input so that only the displayed options can be chosen.

Each option should be processed numerically for easier selection. For instance, option [1] can

be associated with "Ending the Program," option [2] with "Displaying 'Game Rules' Information," and so on.

By implementing this menu system and incorporating input validation, you will create a user- friendly interface that allows for easy navigation and interaction within your program.

Task 2: Read data from a file and display

Your next task is to display the rules of the game, providing detailed information on how to play. This information should be displayed similarly to the example shown here. You can accomplish  this by creating a function and calling it from the runMenu() function when option [2], "Display 'Game Rules' Information," is selected.

The function responsible for displaying the game rules should accept the filename

"gameRules.txt” as a parameter. This function should successfully read and display the data

from the specified file. You can download the "gameRules.txt" file from the unit's Moodle page and place it in the appropriate folder to be read and displayed. However, you should modify the content and format of the file to suit your program's needs. Please keep the file content short.

In the "gameRules.txt" file, make sure to include your details, such as the trimester, unit, and other relevant information. Modify the content of the file as necessary to ensure it integrates    smoothly into your program.

By implementing this task and incorporating the function to display the game rules, you will provide clear instructions on how to play the game.

Task 3: Play Mastermind Game

Your next task is to play the game, the following should be considered when you implement this task.

a.  The Player must be able to do the following:

w assign a name which is requested at the start of the game and used in the feedback given w see all their previous moves at the start of their turn so they can make an informed choice w type in a code, using either letters or numbers and seeing appropriate feedback on the accuracy of their input

w continue typing in codes and seeing feedback until they either “crack the code” or run out of turns

w quit the game at any time – during or after a game

b.  The Board in the game should have the following characteristics:

w a defined number of columns (code slots) and rows (the maximum turns a player has)

w be able to display each code entered and given feedback as a specific row w be able to reset the board to empty at the end of a game

w not be able to add any more rows beyond the specified number

c.  The Game Application must do the following:

w display the “how to play” information at the start of the game

w create or select a secret code – using words/letters, symbols and/or numbers

w display an appropriate and uncluttered user interface providing relevant information to the player at all times

w ask for and allow the player enter a code

w 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)

w display the updated game board after each code entered by the player

w terminate the game (player wins) when the player has guessed the code

w terminate the game (player loses) when the player has run out of turns

w provide player stats at the end of the game (wins, loses and score)

w the player should be able to QUIT the game at any time

See the rest of the screenshots for this task at the end of this document.

Task 4: Display the Reflection Report

Your final task is to display the reflection report and all the extra functionality that you have

implemented.

Create a function for this task and call it from the runMenu() function, when option this option is selected.

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:

w Discuss why you designed it the way you did:

Explain the reasoning behind the structure of your classes and how they relate to each other?

Describe how this design reflects an object-oriented (OO) approach?

w Discuss how well you were able to code it:

Highlight any challenges or issues you encountered during the implementation phase.

Discuss how you addressed these issues, whether through debugging, refactoring, or   seeking assistance. Reflect on the effectiveness of your coding skills and how well you were able to translate your design into functional code.

w Furthermore, consider how you would improve your design if you were to undertake the project again. Discuss potential modifications to make your solution easier to implement, more efficient, or better suited for code reuse.

w It  is  necessary  to  include  a  list  of all  implemented  extra functionalities  in  the  report otherwise, will not be marked.

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 (For HD Students)

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.

a.  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.) [5]

b.  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 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. [5]

c.  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. [5]

d.  Having at least one extra class in the game. [5]

e.  Use pointers to point to data members. [5]

f.   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. [10]

g.  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). [10]

h.  Display the board using ASCII art. [10]

i.   Allow the game to be saved and restored at the player’s request. [10]

j.   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). [10]

k.  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). [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!

Assignment 3: Marking Criteria [up to 100 marks in total]

Does the program compile and run? Yes or No

1. Class Design [15]

1.1.  Class A [5]

1.1.1. Has an appropriate header file? all member functions and data members presented correctly. [2.5]

1.1.2. Implemented correctly in .cpp file. [2.5]

1.2. Class B [5]

1.2.1. Has an appropriate header file? all member functions and data members presented correctly. [2.5]

1.2.2. Implemented correctly in .cpp file. [2.5]

1.3.  Game Application [5]

1.3.1. Has an appropriate header file? has all function prototypes? [2.5]

1.3.2. Implemented correctly in .cpp file. [2.5]

2. Functionality [45]

2.1. Create and display menu repeatedly till user exit. [5]

2.2. Display Game Rules file, with correct validations. [5]

2.3. Display the reflection report when the option is selected, with correct validations. [5] 2.4. Game set up and implementation of a clear and uncluttered User Interface. [5]

2.5. Initialising the player, game variables and 4 coloured pegs for the hidden code. [5] 2.6. Implementation of the basic game mechanics (guess and response). [5]

2.7. Implementation of updating the board after the guess. [5]

2.8. Implementation score tracking and updating as required. [5]

2.9. Successful implementation of action processes and feedback displayed to the player. [5]

3. Quality of Solution and Code [20]

3.1. The program complied with no error? [10]

3.2. Has a well-designed program been implemented and the Programming Style Guide been followed? [10]

3.2.1 Appropriate use of references and/or pointers [2]

3.2.2 Code is indented correctly [2]

3.2.3 White spaces are used properly [2]

3.2.4 All functions and variables have meaningful names and use correct camel notation [2]

3.2.5 Appropriate use of comments throughout the code (top of the program, above the functions and in line) [2]

4. Extra Functionality [maximum 20]

4.2.   Implement difficulty levels which may be selected by the player [5]

4.3.   Implement an appropriate scoring system based on game parameters [5]