-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pawn.h
68 lines (53 loc) · 1.27 KB
/
Pawn.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
// jammon17@georgefox.edu
// Assignment 9
// 2019-04-24
#ifndef _PAWN_H
#define _PAWN_H
#include "Piece.h"
// forward declarations
class Square;
class Player;
class Queen;
/**
* Implements a Pawn object that extends RestrictedPiece
*/
class Pawn: public Piece {
using Piece::Piece; // lift constructor
public:
/**
* Checks if the piece object can move to the given Square
*
* @param location (Square&)
* @return true if the move is valid else false
*/
bool canMoveTo(Square& location) override;
/**
* Moves the piece object to the given Square
*
* @param location (Square&)
* @param byPlayer (Player&)
* @return true if the move is valid else false
*/
bool moveTo(Square& location, Player& byPlayer);
/**
* Flag function that maintains whether or not
* a piece has moved. This is used to determine
* valid moves.
*
* @return true if the piece has moved
*/
bool hasMoved();
/**
* Displays the Bishop color and type
*/
void display() override;
/**
* De-constructor for Pawn that deletes the instance of delegate
*/
~Pawn();
private:
// private attributes
bool moved = false;
Queen* _delegate = nullptr;
};
#endif //_PAWN_H