ENGG1340/COMP2113 Programming Technologies - Group Project
Group: 165
MessyGrid is a puzzle game where a player is given a grid of numbers in random order except there is one empty cell with no number. The aim is to move the numbers around until the order is restored.
Name: Lui Ka On (UID: 3035074610)
Name: Ye Zhongzheng (UID: 3035782176)
- The player chooses the size of the grid, e.g. 5x5 or 4x6.
- After a random board arrangement with one empty cell is generated, the player moves one of the number around the empty cell into the empty cell.
- Player continues to move the numbers around one at a time until the numbers on the board is in ascending order (from left to right, top to bottom). Then the game is finished.
- The player can save the game progress at any time.
- The player can load a previous saved progress and resume the game.
- During the game the system keeps recording the cumulative number of moves.
- The system generates a grid of a custom size based on the player's
preference.
- Fulfills requirement 2: Using a class to store the grid configuration in its member data and provide methods to manipulate the grid. The game also uses structs to store a particular location of a cell in the grid. These class and structs provide data structures for storing game status.
- Fulfills requirement 3: Using dynamic 2D-array for custom-sized grid.
- The system takes away the largest number, leaving one empty cell on the
grid, and then uses a random generator to produce a serious of random moves
to generate a chaotic board arrangement. The arrangement generated will
always have an empty cell at the bottom right.
- Fullfills requirement 1: Creating random initial status - random game event
- The system awaits input from the player (
W
,S
,A
,D
for Up, Down, Left, Right) to move the numbers around. - The system updates the board arrangement and prints it on screen upon each move.
- The system stores a game progress by storing it in a save file upon a save
command by the user.
- Filfills requirement 4: File output to save game status
- The system loads a previously saved game progress by reading a save file upon
a load command by the user.
- Fulfills requirement 4: File input to load game status
- Different codes (e.g. functions) for different features are separated into
multiple source and header files. E.g. a header file and a source file are
dedicated to the class Grid; a main source file is dedicated to a simple main
function which is the entry point of the program; and etc.
- Fulfills requirement 5: Program codes in multiple files
Type make
in the terminal to compile the program. The path of the compiled
program is bin/main
. Alternatively, you can compile and run the program with a
single command make run
.
See test/game/input
and test/game/output
for some sample input and sample
output files. Note that a portion of the sample output files there are not the
complete output of running the program, but are only a part of the output for
the purpose of game testing.
For the requirement of the project, there is another prepared sample output file
sample_output.txt
, whose content is the complete output of running the game
with a sample input from test/game/input/input_play_2x2_1.txt
.