-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueen.cpp
More file actions
33 lines (27 loc) · 785 Bytes
/
Queen.cpp
File metadata and controls
33 lines (27 loc) · 785 Bytes
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
#pragma once
#include "Chess.h"
#include"Piece.h"
#include"Bishop.cpp"
#include"Rook.cpp"
#include <iostream>
using namespace std;
class Queen : public Bishop, public Rook // Virtual Inheritance from Bishoop and Rook
{
public:
Queen(bool c) : Piece(c, 5)
{
PieceImage.setTextureRect(IntRect(ImageSize * 4, ExtractColor(color) * ImageSize, ImageSize, ImageSize));
}
bool isValid(int xfrom, int yfrom, int xto, int yto, Piece* b[8][8])
{
if (Piece::isValid(xfrom, yfrom, xto, yto, b))
if (Bishop::isValid(xfrom, yfrom, xto, yto, b) || Rook::isValid(xfrom, yfrom, xto, yto, b))
return true;
return false;
}
void Print(int x, int y)
{
PieceImage.setPosition(ImageSize*x, ImageSize*y);
cout << (color ? 'W' : 'B') << 'Q';
}
};