-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameState.h
More file actions
54 lines (39 loc) · 1.29 KB
/
GameState.h
File metadata and controls
54 lines (39 loc) · 1.29 KB
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
49
50
51
52
53
54
//
// Created by david on 4/9/20.
//
#ifndef PANDEMONIUM_C_CODE_GAMESTATE_H
#define PANDEMONIUM_C_CODE_GAMESTATE_H
#include "Piece.h"
#include <vector>
#include "Position.h"
#include <iostream>
//organized in counter-clockwise direction for your convenience
const int ADJACENT_VECTORS[6][2] = {{1,0}, {0,1}, {-1, 1}, {-1, 0}, {0, -1}, {1, -1}};
/*
* 'pieces' should be the only permanent date structure used.
*
*/
class GameState{
public:
GameState();
GameState(const GameState& other);
~GameState();
void addPiece(int pos_x, int pos_y, int team, int type);
void addPiece(int pos_x, int pos_y, int team);
void removePiece(Piece *p);
bool position_empty(int pos_x, int pos_y);
void movePieceAbsolute(Piece *p, int pos_x, int pos_y);
void movePieceRelative(Piece *p, int move_x, int move_y);
std::vector<Position> getAdjacentSpaces(int pos_x, int pos_y);
bool areAdjacent(Position pos_1, Position Pos_2);
bool pieceExists(Piece *p);
std::vector<Piece*> pieceList();
bool onBoard(int x, int y);
Piece* atLocation(int x, int y);
Piece* correspondingPiece(Piece *p, GameState other);
std::string GameStateToStringConverter();
void printBoardInText();
private:
std::vector<Piece *> pieces;
};
#endif //PANDEMONIUM_C_CODE_GAMESTATE_H