forked from mr-andreas/neuralnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgamestate.h
More file actions
47 lines (32 loc) · 682 Bytes
/
Copy pathgamestate.h
File metadata and controls
47 lines (32 loc) · 682 Bytes
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
#ifndef _GAMESTATE_H
#define _GAMESTATE_H
#include <vector>
#include "CNeuralNet.h"
#include "CGenAlg.h"
class Sweeper {
public:
Sweeper();
double posx, posy;
// Rotation, value between 0 and 1
double rotation;
CNeuralNet brain;
int minesSweeped;
// Resets fitness
void reset();
};
typedef struct {
int posx, posy;
} Mine;
class Gamestate {
public:
Gamestate(int boardWidth, int boardHeight);
int boardWidth, boardHeight;
std::vector<Sweeper> sweepers;
std::vector<Mine> mines;
CGenAlg *genAlg;
vector<SGenome> population;
void initGenAlg();
};
void doTurn(Gamestate *gs);
void brainTransplant(Gamestate *gs);
#endif