-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.h
30 lines (30 loc) · 824 Bytes
/
board.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
#ifndef BOARD_H
#define BOARD_H
#include "tile.h"
/* * * * * * * * * * * * * * * * *
* Board object has a 4x4 array of pointers to Tile objects.
* New tiles are added to the board with spawn_tile(), and the tiles
* can be combined using move().
*/
enum class Move {UP, DOWN, LEFT, RIGHT, INVALID};
class Board {
public:
Board(int tile_count, bool debug);
~Board();
int move(Move direction);
Tile* spawn_tile();
void draw();
int get_score();
bool is_full();
private:
Tile* tiles[4][4];
int score;
Tile** find_space(void);
int move_tile(int row, int col, int row_shift, int col_shift);
void clear();
void draw_top();
void draw_row();
void draw_boundary();
void draw_bottom();
};
#endif