Assignment 6B: Maze Game - Version 2! In the "real world", you rarely write a piece of software once and then leave it. Instead, you make updates and fixes as you improve as a programmer. In this assignment, we are going to take our code from Assignment 5 B and make the following code improvements with methods. Note for C++ Students: To use a 2D array as a parameter, you need to include the numbers of columns in the method header. For example, "void setArray (int arr[][5])" would accept a 5×5 2D array. - Create a method called checkValidPosition. It should take in as parameters the current 2D array and two ints - one that represents the new X position and one that represents the new Y position of the Player. It should determine if the new position is valid (within the bounds of the array), and return a boolean TRUE or FALSE to the Main method. This function should be used to replace the code that was previously used to do this work in your code from Assignment 5 B. - Create a method called checkGameStatus. It should take in as parameters the current 2D array and two ints that represent the X/Y position of the player. It should determine if the player is on the path or has won or lost the game. It should return an integer to the Main method that represents each state: - Returning 0 means the player has lost - Returning 1 means the player is still playing the game - Returning 2 means the player has won the game. This function should be used to replace the code that was previously used to do this work in your code from Assignment 5B.
- Create a method called printMaze. It should take in as parameters the current 2D array. It should print the maze to the screen; it should not return any value to the Main method. This function should be used to replace the code that was previously used to do this work in your code from Assignment 5 B. he program should produce identical output to the sample output shown in Assignment B.
Assignment 6B: Maze Game - Version 2! In the "real world", you rarely write a piece of software once and then leave it.
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Assignment 6B: Maze Game - Version 2! In the "real world", you rarely write a piece of software once and then leave it.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!