List of contents
- Tsang Ka Yu UID: 3036067602
- Wu Ziye UID: 3036094576
- Yang Haozhe UID: 3035973725
- Zhong Ching Yu UID: 3036066452
- Zhou Ziyue UID: 3035980314
Feeling bored while playing a traditional maze game? Try the Maze Explore Adventure now by downloading folder Finalized_our_maze
! The maze is now full of fog and darkness, so you won't be able to see everything. As the name suggests, you have to explore the maze yourself and find the exit with limited vision.
- We used the
getch()
function from<ncurses.h>
, a useful library for creating an interactive user interface. The user can move the game character using WASD, like most games.
- We used
ioctl()
function from<sys/ioctl.h>
to detect the window size - It reminds you with a sentence shown on the top if the system detects that the current window size is not big enough.
- Minimum window size: 45*45
- A classic maze game where all objects are visible.
- Please note that the record system will only be available in this mode.
- Use WASD to move.
- A special version of the maze game where only objects near you are visible.
- You can increase your sight by pressing 'z'
- You can reduce your sight by pressing '-'
- Use WASD to move.
- You can change the size of the maze.
- Recommended range: 10-40.
- If the size is larger than 40, please make sure you have sufficient space (window size) to display the maze.
- We used a 2D vector to store the maze.
- The game status, namely time used, player's name, size of the maze, and game mode are stored in a structure called "Record." Upon completing the game, this data will be displayed on the screen and exported to a txt file.
- Once the game is ended, the system will insert all the game status as a new record to the txt file. We used a dynamic array to store all the records (including the latest one) and sort them using the
SortByTime
function. After that, the records will be exported to a txt file, and the array will be deleted usingdelete[]
.
- All records are stored in the corresponding txt file.
- If the game is ended, the system will read records from the txt file.
- The system will insert a new record and sort all the records.
- Finally, the system will output all results to the txt file.
- Repeat steps 2-4 until the end of the program.
Example:
Assuming that you have just finished a classic maze with a size of 20*20, a text file called "rank_Classic.txt" will be generated afterward.
Please enter your name: Erin
------------------------------
Player: Erin
Gamemode: Classic
Size: 20
Gametime: 14
------------------------------
Top 5 records in Classic
1 9
2 14
3 60
4 999
5 999
------------------------------
Enter 0 if you wish to exit, else enter anything else to continue:
Our system will display the records in chronological order on the terminal.
1 9
2 14
3 60
4 999
5 999
You will see something like this if you open the txt file
- The
main.cpp
file controls the core functions, such as player movement, game mode selection, etc. - The
Maze_generation.cpp
andMaze_generation.h
files contain functions that can generate the maze randomly, print the UI, update the player's location, etc.
- Download the folder
Finalized_our_maze
- Unzip the folder which you downloaded just now
- Type
make main
in your terminal under the parent directoryFinalized_our_maze
- The executable file
main
should appeared, type./main
to run it - Enjoy the game