-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtetris.h
More file actions
45 lines (35 loc) · 710 Bytes
/
tetris.h
File metadata and controls
45 lines (35 loc) · 710 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
#include <string.h>
extern const char STONE_DATA[7][16];
enum {
CELL_SIZE = 20,
GRID_WIDTH = 10,
GRID_HEIGHT = 20,
STONE_COUNT = sizeof(STONE_DATA) / sizeof(STONE_DATA[0])
};
typedef struct Particle Particle;
struct Particle {
Particle* next;
int c;
float x;
float y;
float vx;
float vy;
};
typedef struct {
int x;
int y;
int rot;
int stone;
int perm[STONE_COUNT];
int perm_pos;
int lines;
int stones;
int tick;
enum { NORMAL, FALLING, BLINK, OVER } state;
int cells[GRID_HEIGHT][GRID_WIDTH];
int full_lines[GRID_HEIGHT];
Particle* particles;
int quake;
} Grid;
int collision(const Grid* grid, int over);
int bot(Grid* grid, int depth, int* dx, int* dy, int* rot, int* fall);