HKU ENGG1340/COMP2113 (2023 - 2024) Group 19 Project
This project will be continued https://github.com/avcode-exe/ENGG1340-Group-19-Project-V2.
Our project consists of a maze game and a minesweeper game.
To begin with, the player has to complete the maze while avoiding monsters nearby. However, if the player gets hit by the monster, the player will be sent to a game of minesweeper. If the player loses during the minesweeper game, a health point will be deducted and the player returns to the maze game.
The goal is to reach the exit of the maze before the player loses all health points.
A maze generated using recursive randomized Prim's algorithm
<random>
. The algorithm then removes the wall between the original coordinates and the selected frontier and thus carve a path.potentialFrontiers
array, a list of frontiers the algorithm can choose from randomly.<fstream>
. The content of the maze in the text file is then loaded to mazeGame.cpp
and printed on the screen.There are monsters moving in various locations of the maze and checkpoints generated in random locations
A game of minesweeper commences when the player is hit by the monster
rand()
from <cstdlib>
is used to generate random coordinates for mines.<fstream>
, which is then loaded to minesweeper.cpp
and printed on the screen.Download the repository as a zip file. Alternatively, you can also run this command to clone the repository to your local device:
git clone https://github.com/avcode-exe/ENGG1340-Group-19-Project.git
Navigate to the folder. To run the game, simply run make run
to compile and execute the program.
After running make run
to start the game, you will be prompted whether a new maze should be generated or not:
You will begin at the starting position of the maze. Navigate in the maze using W, A, S, and D keys. The number of health points remaining is shown on the right with "HP". Try to reach the goal position without losing all health points. If you get hit by a monster, you will be sent to a game of minesweeper.
In the minesweeper game, you can navigate in the game board using W, A, S, and D keys. To reveal a tile, press the spacebar. If a mine, denoted with "X", is revealed, you lose the minesweeper game and will return to the maze with one health point deducted. Otherwise, the minesweeper game continues.
For example, the following shows that a mine is found:
###
#X#
###
If a number is shown instead of a mine, the number represents how many mines are nearby in a 3x3 range with the number at the center of the range.
For example, the following snippet shows that there are 2 mines within this 3x3 range:
###
#2#
###
If an empty cell is revealed instead of a number, it indicates that there are no mines near this tile.
For example, the following snippet shows that there are no mines within this 3x3 range:
###
# #
###
Apart from revealing tiles, you can also toggle flag mode using the F key. To place a flag on a tile, make sure that flag mode is on, navigate to a tile and press spacebar. The letter "F" will show up on tiles with a flag placed on them.
Keep in mind that you cannot choose tiles that are already revealed. However, you can choose tiles that have a flag placed on them because they have not been revealed yet.
Have fun!