-
Notifications
You must be signed in to change notification settings - Fork 0
/
Square.h
81 lines (65 loc) · 1.33 KB
/
Square.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// jammon17@georgefox.edu
// Assignment 9
// 2019-04-24
#ifndef _SQUARE_H
#define _SQUARE_H
#include "Piece.h"
// forward declarations
class Piece;
/**
* Implements a Square object with a rank and file (row and column)
*/
class Square {
public:
/**
* Square Constructor
*
* @param rank - row
* @param file - column
*/
explicit Square(int file = 0, int rank = 0);
/**
* Gets rank attribute
*
* @return rank (int)
*/
int getRank();
/**
* Gets File attribute
*
* @return file (int)
*/
int getFile();
/**
* Checks if the square object contains
* any piece objects
*
* @return true if occupied else false
*/
bool isOccupied();
/**
* Returns a pointer to the Piece object
* If there is not occupant the pointer will be null
*
* @return occupant (Piece*)
*/
Piece* getOccupant();
/**
* Sets the occupant attribute to a pointer to a Piece object
*
* @param occupant (Piece*)
*/
void setOccupant(Piece* occupant);
/**
* Displays the occupants of a square
* If there is not occupant two whitespaces
* will output
*/
void display();
private:
// private attributes
int _rank;
int _file;
Piece* _occupant;
};
#endif //_SQUARE_H