-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrook.cpp
More file actions
48 lines (43 loc) · 1.16 KB
/
rook.cpp
File metadata and controls
48 lines (43 loc) · 1.16 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
/***********************************************************************
* Source File:
* ROOK : Handles the rook piece on the board.
* Author:
* Emilio Ordonez and Austin Jesperson
* Summary:
* A rook on the chess board.
************************************************************************/
#include "rook.h"
/****************************************************
* CONSTRUCTOR
* Create a Rook object
***************************************************/
Rook::Rook(Position pos, bool color, PieceType pt)
{
position = pos;
fWhite = color;
type = pt;
canSlide = true;
possibleDirections = 4;
}
/****************************************************
* DRAW
* Draws the rook on the board
***************************************************/
void Rook::draw(ogstream& gout)
{
gout.drawRook(position.getLocation(), fWhite);
}
/****************************************************
* GET DIRECTIONS()
* Get the directions the rook can travel to
***************************************************/
RC* Rook::getDirections()
{
RC* moves = new RC[4]{
{0, 1},
{-1, 0},
{1, 0},
{0, -1}
};
return moves;
}