-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlockFall.h
45 lines (34 loc) · 1.89 KB
/
BlockFall.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 BLOCKFALL_H
#define BLOCKFALL_H
#define occupiedCellChar "██"
#define unoccupiedCellChar "▒▒"
#include <vector>
#include <string>
#include "Block.h"
#include "LeaderboardEntry.h"
#include "Leaderboard.h"
using namespace std;
class BlockFall {
public:
BlockFall(string grid_file_name, string blocks_file_name, bool gravity_mode_on, const string &leaderboard_file_name,
const string &player_name);
BlockFall(string grid_file_name, string blocks_file_name, bool gravity_mode_on);
virtual ~BlockFall();
int rows; // Number of rows in the grid
int cols; // Number of columns in the grid
vector<vector<int>> grid; // 2D game grid
vector<vector<bool>> power_up; // 2D matrix of the power-up shape
Block * initial_block = nullptr; // Head of the list of game blocks. Must be filled up and initialized after a call to read_blocks()
Block * active_rotation = nullptr; // Currently active rotation of the active block. Must start with the initial_block
bool gravity_mode_on = false; // Gravity mode of the game
unsigned long current_score = 0; // Current score of the game
string leaderboard_file_name; // Leaderboard file name, taken from the command-line argument 5 in main
string player_name; // Player name, taken from the command-line argument 6 in main
Leaderboard leaderboard;
void initialize_grid(const string & input_file); // Initializes the grid using the command-line argument 1 in main
void read_blocks(const string & input_file); // Reads the input file and calls the read_block() function for each block;
vector<vector<bool>> turntoVector(std::string blocktext);//Turn a string block, into a vector
vector<vector<bool>> transpose(vector<vector<bool>> inputVector);//Right rotate/ Transpose a vector.
void setupRotations(Block* current);
};
#endif // BLOCKFALL_H