-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstate.h
45 lines (37 loc) · 826 Bytes
/
state.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
#ifndef _STATE_H
#define _STATE_H
#define HEIGHT (4)
#define WIDTH (4)
#define WARPING (false)
#include <vector>
#include "hash_state.h"
using namespace std;
class state
{
int move_dif[4][2]=
{
{ 0,-1},
{-1, 0},
{ 0, 1},
{ 1, 0}
};
int base[HEIGHT][WIDTH];
int offset;
int length;
int head_i,head_j;
int apple_i,apple_j;
int tail_i,tail_j;
public:
long long board_hash;
int gen_apple(void); //attempts to place an apple in a random place
void clear_offset();
public :
int make_move(int dir); //makes a move in a direction
//(left, up, right, down)
void show (void);
state (void);
//bool operator < (const state &cp) const;
state (std::vector <pair <int,int> > val);
hash_state to_hash();
};
#endif // _STATE_H