Monster Maze
Overview:
For this project, you will implement a maze. The maze will be represented as a grid (i.e. matrix). The user will be allowed to set the number of rows and columns. They will also select a number of monsters to be hidden inside the maze.
Before the game starts, the monsters will be placed/hidden in random locations on the grid. Note – there should never be a monster in the start or end cell. The player will also be able to see the number of neighbor monsters/any monsters themselves inside the three elements surrounding their starting location.
The player will start in the upper left-hand cell of the maze. Their goal is to make their way to the bottom right-hand cell of the maze (i.e. the “exit”) in as few moves as possible. The user can move into any cell that exists.
As they move, information about the grid will slowly be revealed in the form of numbers that indicate how many monsters are in neighboring elements.
The player’scurrentlocation will be shown with a >.
If the player moves into a space containing a monster, the game is over and they lose. If them make it to the final cell without hitting a monster, they win. They should then get the option to play again – which will involve being able to select a new maze size and number of monsters and reset the entire game.
After the initial display and setup of the game, the user will always be able to see their current view of the maze and their current number of moves.
!!!!!!!!!!!!! Your solution MUST make use of appropriate functions such that you neither create a hugely, disgustingly long main nor do you find yourself rewriting snippets of code that could be generalized as a function.
*Optional Component: Assess the player’s skill level based on the number of moves required. This assessment should be dynamic – i.e. it should change based on the overall size of the grid and the number of monsters in the maze.
Useful Things / Hints
1) You can use more than one matrix to keep track of what’s going on in the game.
2) When you read with cin, the user must press the enter key to register their input is complete. This isn’t great for a game with “arrows” being used to direct “movement”. It is possible to actually read a single character input with _getch() and NOT require the enter key press as well. (NOTE: unfortunately, it doesn’t work with the actual arrow keys, which is why we’re using w, a, s, and d for our “arrows”).
What this looks like in code:
char arrow;
arrow = _getch();
Game Rules
There are MONSTERS hiding in the maze! Your goal is to reach the end in the fewest moves possible without running into one of the MONSTERS! Every move you make will reveal a count of the monsters in neighboring cells. A > will show where you are currently located in the maze. You can move up(w), down(s), left(a), or right(d) on each turn. You may revisit cells you were already on, but it will cost you moves! Good luck avoiding the MONSTERS!
Game Play
…..some time later
NOTE – the & is a monster!