-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrid.h
55 lines (41 loc) · 1.25 KB
/
Grid.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// a. Michael Bertagna
// b. 2353491
// c. bertagna@chapman.edu
// d. CPSC 350-01
// e. Assignment 3
/* Grid.h is a header file which lays out the elements of the Grid class. */
#ifndef GRID_H
#define GRID_H
#include <iostream>
#include <cstdlib> //for srand/rand
#include <time.h> //for time
#include "Cell.h"
using namespace std;
class Grid{
private:
Cell **m_grid;
int m_height;//number of Rows
int m_width;//number of Columns
public:
Grid();//default constructor
Grid(int height, int width, double density);//overloaded constructor for density input
Grid(int height, int width, string gridStr);//overloaded constructor for map file string input
~Grid();//destructor
// getters
int getHeight();
int getWidth();
// checks if cell is occupied
bool isSpecifiedCellOccupied(int height, int width);
// setters
void setCellOccupied(int height, int width);
void setCellEmpty(int height, int width);
// prints grid in user friendly format
void printGrid();
// returns string of grid elements
string getGridString();
//returns specified cell's data
char getSpecifiedCellData(int height, int width);
// checks if string is an +integer
bool isPosInt(string maybeInt);
};
#endif