-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGameData.h
More file actions
48 lines (32 loc) · 789 Bytes
/
GameData.h
File metadata and controls
48 lines (32 loc) · 789 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
45
46
47
48
/*
* this class save all game data
*/
#ifndef INC_2048GAME_GAMEDATA_H
#define INC_2048GAME_GAMEDATA_H
#include <iostream>
class GameData {
public:
bool IsMove;
GameData();
void SetBestRecord(std::string name = "", int bscore = 0);
//get grid (x,y) number from data
// 0 for empty
int GetPositionNumber(int, int);
//change (x,y) to number P
void ChangePositionNumber(int, int, int);
//get my score
int GetScore();
//get history best score
int GetBestScore();
//check if game can move on
bool IsGameOver();
void AddScore(int);
void MakeNewNumber();
void InitNewGame();
private:
int num[4][4];
int score, my_best;
std::string local_name;
int local_best;
};
#endif //INC_2048GAME_GAMEDATA_H