MCD4720 Fundamentals of C++ Assignment 2 and 3
Snake and Ladder Trimester 3, 2022
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: Snake and Ladder (Part A: Project Plan) Due Date: 2 December 2022 (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. 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: Snake and Ladder (Part B: C++ Project Implementation) Due Date: 6 January 2023 (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 CLion 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.
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.docx” or “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: ● 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 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 create a CLion project in order to submit. Your project folder must be identified by using your name and assignment number, such as YourFirstNameLastNameID_A3.
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
You have to submit the whole project not only the .cpp, .h and .txt files. If you have any questions or concerns please contact your tutor as soon as possible.
Assignment 2: Snake and Ladder (Part A)
In this assignment, you are to implement a computer-based variant of the game Snake and Ladder. This is a game mainly for two players who play against each other but it can also be played by a single or multiple player. The basic game of Snake and Ladder is a simple press-your-luck game with one winner. Players score points by moving up on the board. The player who reaches the end of the board first is the winner!
In your version, for the basic assignment you only need to implement a 2-player game. 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
In this program, the game has a board with fifty squares. The player starts at the first square, and they have to manoeuvre through snakes and ladders to get to the 50th square.
There should be at least one dice for the snakes and ladders board game and one pawn per player.
The basic game play is as follows: ● Initialize: The players each roll six-sided dice. The game starts on the left, and each successive roll enables a player to move his/her piece to the right. Ultimately, the game is won when the first player’s piece gets to level 50, which is on the right. To place the snakes and ladders on the board, you need three snakes and three ladders. a. The Snake i. The first snake is represented as S1 and is placed on square 17 and 36 b. The Ladder i. The first ladder is represented by L1 and is placed on square 4 and 25 with bottom on 4 and top on 25, ii. The second ladder is represented by L2 and is placed on square 8 and 34 with bottom on 8 and top on 34 and iii. The third Ladder L3 is placed on square 12 and 31 with bottom on 12 and top on 31.
● To start the game, the player with the highest roll gets to be player one, and the player with the least score becomes the last player. ● Player’s turn: Each player has a turn. They roll the dice and move the number of squares scored in the roll. According to the Snake and Ladders rules ● No move: To win the game, Snake and Ladders rules require a player to roll the dice and get the exact steps needed to win the game. Say if you are left with two spots, then your dice roll must indicate 2. If you get six, you will stay in the same spot. ● Winning the Game: There is only one winner. According to the Snakes and Ladders rules, the first player that successfully gets to the 50th square wins the game.
Note: There are many variations to this basic game, some of which you will be able to implement as a part of the extra functionality for your assignment. 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 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) ⬥ 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: ⬥ 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 hazards such as snakes and 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 is 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, Location and Application (main) class.
Assignment 3: Snake and Ladder (Part B)
You are to implement the Snake and Ladder card game you started in Assignment 2 by creating a CLion Project using your project plan as described in your previous submission.
Your completed Snake and Ladder 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 the player’s details including their name, current score and a collection of cards (the player’s stack in the game). ● Board class: holds the board details including the shortcuts and hazards, a visual representation of the board and its squares. ● 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 ● rolls the dice to generate a random number and see appropriate feedback as a result ● continue playing until a winner is found ● quit the game at any time – during or after a game ● The Board in the game should have the following characteristics: ● have 50 squares ● 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 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 CLion project. Your document file MUST be named as follows: “YourFirstNameLastNameID_A3.docx” or “YourFirstNameLastNameID_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.
- Having at least two more classes in the game.
- The player can set the number of squares that they want to play with.
- Implement the bounce back rule which is when the player is only a few squares away from the end of the board. Such as if the player is left with two spots, then his/her dice roll must indicate
- Implement the strategy of roll twice. Snakes and Ladders rules occasionally award a player two turns. If you roll the dice and are lucky enough to get six, you will be given an opportunity to roll the dice again. The opportunity to keep rolling the dice will continue until the streak runs out.
- You could use any other formula for calculations. The formula must be given in the instructions or game rules.
- Display the Board using ASCII art. You can use different images related to a theme or patterns for the numbers, snakes and ladders.
- Allow the game to be saved and restored at the player’s request.
- Continuous Snake and Ladder alternative game play option. The players must select which version of the game (such as how many squares, snakes and ladder) to play at the start of the game.
- Allow the game to be played with multiple players, more than two. The game allows you to find the loser instead of the winner. The player who reaches the end of the board last is the loser.
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!