-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPawn.cpp
More file actions
59 lines (47 loc) · 1.25 KB
/
Copy pathPawn.cpp
File metadata and controls
59 lines (47 loc) · 1.25 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
55
56
57
58
/****************************************************/
/* */
/* Date Created: 01/12/14 */
/* Description: Implementation of Pawn class. */
/* A pawn is a ChessPiece */
/* */
/* Date Who Description of Change */
/* 20141201 HL Created. */
/****************************************************/
#include <string>
#include<cstdlib>
#include "Pawn.hpp"
using namespace std;
Pawn::Pawn(colours _colour) {
colour = _colour;
if(colour == WHITE) {
moves[0] = NORTH;
}
else {
moves[0] = SOUTH;
}
number_of_moves = 1;
has_special_moves = true;
}
Pawn::~Pawn() {
return;
}
int Pawn::getMoveMultiple(move_type direction) {
if (has_moved)
return 1;
if (direction == NORTH || direction == SOUTH)
return 2;
return 1;
}
bool Pawn::hasCaptureMove(move_type capture_moves[],
int &number_of_capture_moves) {
if(colour == WHITE) {
capture_moves[0] = NORTH_WEST;
capture_moves[1] = NORTH_EAST;
}
else {
capture_moves[0] = SOUTH_WEST;
capture_moves[1] = SOUTH_EAST;
}
number_of_capture_moves = 2;
return true;
}