-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpiece.h
42 lines (34 loc) · 1.13 KB
/
piece.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
#ifndef __PIECE_H__
#define __PIECE_H__
#define ALL_PIECE_PATTERNS 2497
#define PIECE_TYPES 4
#define PIECE_PUT_TYPES 16
#define PIECE_X 8
#define PIECE_Y 8
typedef unsigned long long int t_piece; // ブロックの有無
struct Piece {
unsigned char type; // ブロックの種類
t_piece piece0, piece1, piece2; // ブロックの有無 (それぞれ 1 段目・2 段目・3 段目)
static Piece EMPTY;
static void init();
bool isEmpty();
bool equals(Piece p);
int getIndex();
static Piece get(int index);
static Piece get(int y, int x, int type, int dir);
static Piece get(char *s);
static int getNumberOfPieces(int type);
Piece flip(int tflag);
Piece flipInv(int tflag);
bool getString(char *str);
protected:
static Piece ALL_PIECES[ALL_PIECE_PATTERNS];
static int ALL_PIECES_INDEX[PIECE_PUT_TYPES][4][PIECE_Y][PIECE_X];
static int ALL_PIECES_TYPE[ALL_PIECE_PATTERNS];
static int ALL_PIECES_DIR[ALL_PIECE_PATTERNS];
static int ALL_PIECES_Y[ALL_PIECE_PATTERNS];
static int ALL_PIECES_X[ALL_PIECE_PATTERNS];
};
extern const Piece DEFAULT_PIECES[PIECE_PUT_TYPES][4];
extern const int DEFAULT_PIECE_TURNS[PIECE_PUT_TYPES];
#endif