-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap.h
executable file
·99 lines (88 loc) · 2.27 KB
/
map.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* Project name: Food collection
* Version 4
* Student : Albert Eduard Merino Pulido
*/
#ifndef map_h
#define map_h
#include <iostream>
#include <cstdlib>
#include <vector>
#include <ctime>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <stack>
#include <list>
#include "cell.h"
using namespace std;
class Map {
public:
static const int initX;
static const int initY;
static float seed;
static bool isSeed;
// Constructors
Map();
Map(int, int);
Map(char *);
// Getters
int getHeight();
int getWidth();
void setSeed(float);
float getSeed();
vector<vector<Cell *> > getMap();
string toString();
// Methods
void generate();
Cell * getInitPosition(CellType);
void setPosition(CellType, Cell *);
vector<Cell *> getFood();
vector<Cell *> getCandidateFood();
bool isCandidate(Cell *);
int getScore(CellType);
Cell * getPosition(CellType);
void setBulletEnable(bool);
bool getBulletEnable();
bool isInInitialPosition(CellType);
int getFoodRemaining();
bool hasFood();
void eat(CellType);
void incrementScore(CellType);
vector<Direction> getLegalActions(Cell *);
Map generateSuccessor(CellType, Direction);
Cell * getNextState(Cell *, Direction);
void crash(CellType);
void getStateRepresentation(Map currentState, Map lastState);
// Print
void print();
int scorePlayer, scoreEnemy;
private:
void initCells();
void connect(Cell *);
void connectCells();
void inside();
void middle();
void inferiorRandom();
void middleRandom();
void openRandom(Cell *, vector<Direction> );
void mirror();
void initMap();
bool insideCondition(unsigned int, unsigned int);
void initWhitePositionCells();
Cell * randomDiscoverPath(Cell *);
void getMapFromFile(char *);
void print(vector<vector<Cell *> > );
void populateStateRepresentation(vector<vector<vector<vector<int> > > > &all, int tensor, Map state);
void printState(vector<vector<vector<vector<int> > > > all);
protected
: int height, width;
vector<vector<Cell *> > map;
vector<vector<Cell *> > visited;
int totalFood;
Cell * player;
Cell * enemy;
Cell * bullet;
bool bulletEnable;
};
#endif // ifndef map_h