Project Submission (late)

Dependencies:   mbed

Committer:
el17tc
Date:
Fri May 10 14:52:28 2019 +0000
Revision:
3:83e79d31930c
Parent:
0:72f372170a73
final commit, API is added.; I'm not sure if there is a specific statement of academic integrity wanted but- I declare that this work is 100% my own, I have not plagiarised any work or attempted to fabricate any part of it for extra marks.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17tc 0:72f372170a73 1 #ifndef MAZE_H
el17tc 0:72f372170a73 2 #define MAZE_H
el17tc 0:72f372170a73 3
el17tc 3:83e79d31930c 4 /** Maze Class
el17tc 3:83e79d31930c 5 * @brief This class is responsible for selecting, storing and manipulating the current maze.
el17tc 3:83e79d31930c 6 * @brief It also makes it easier to pass the 2D array of the matrix to other classes
el17tc 3:83e79d31930c 7 * @brief that need access to the maze's data, such as Drawer and Player.
el17tc 3:83e79d31930c 8 *
el17tc 3:83e79d31930c 9 * @brief All pre-defined matrices are 20x20 in size, even if their actual size is smaller
el17tc 3:83e79d31930c 10 * @brief The extra space is padded with 1's, this is to make the function calling significantly
el17tc 3:83e79d31930c 11 * @brief simpler.
el17tc 3:83e79d31930c 12 *
el17tc 3:83e79d31930c 13 * @brief Version 1.0
el17tc 3:83e79d31930c 14 * @author Thomas Caine
el17tc 3:83e79d31930c 15 * @date May 2019
el17tc 3:83e79d31930c 16 */
el17tc 0:72f372170a73 17 class Maze {
el17tc 0:72f372170a73 18
el17tc 0:72f372170a73 19 public:
el17tc 3:83e79d31930c 20 /** Create a Maze object to manage the maze matrix.
el17tc 3:83e79d31930c 21 */
el17tc 0:72f372170a73 22 Maze();
el17tc 3:83e79d31930c 23 /** Fill the maze matrix with a specific value in every cell
el17tc 3:83e79d31930c 24 * @param val - the value to put in every cell
el17tc 3:83e79d31930c 25 * Used to reset the maze by setting it to all 1's (solid cells)
el17tc 3:83e79d31930c 26 * every time the game restarts.
el17tc 3:83e79d31930c 27 */
el17tc 0:72f372170a73 28 void fillMaze(int val);
el17tc 3:83e79d31930c 29 /** Copies the contents of a maze to the object's version
el17tc 3:83e79d31930c 30 * @param maze - a predefined maze to be copied into the object's matrix field.
el17tc 3:83e79d31930c 31 * @details the mazes passed to this function are all pre-defined in MazeMatrices.h
el17tc 3:83e79d31930c 32 */
el17tc 0:72f372170a73 33 void copyMaze(int maze[20][20]);
el17tc 3:83e79d31930c 34 /** Randomly selects a maze of a specified size
el17tc 3:83e79d31930c 35 * @param size - can be 12, 16 or 20, all mazes are square.
el17tc 3:83e79d31930c 36 * @details this function will randomly select one from 3 pre-defined mazes.
el17tc 3:83e79d31930c 37 */
el17tc 0:72f372170a73 38 void selectMaze(int size);
el17tc 0:72f372170a73 39
el17tc 0:72f372170a73 40 public:
el17tc 0:72f372170a73 41 int mazeMatrix[20][20];
el17tc 0:72f372170a73 42 int startX;
el17tc 0:72f372170a73 43 int startY;
el17tc 0:72f372170a73 44 int timeToFinish;
el17tc 0:72f372170a73 45
el17tc 0:72f372170a73 46 };
el17tc 0:72f372170a73 47
el17tc 0:72f372170a73 48
el17tc 0:72f372170a73 49
el17tc 0:72f372170a73 50 #endif // MAZE_H