-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXiangqiBoard.h
49 lines (42 loc) · 1.47 KB
/
XiangqiBoard.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
#pragma once
#include <map>
#include "Board.h"
class XiangqiBoard : public Board
{
public:
XiangqiBoard();
~XiangqiBoard() override;
void Initialize() override;
Board* Clone() override;
Piece* CreatePiece(PieceType pieceType, PieceColour pieceColour) override;
void GetMoves(Piece *piece, int x, int y) override;
bool Move(int oldX, int oldY, int newX, int newY) override;
void WriteMove(PieceType pieceType, int x1, int y1, int x2, int y2);
std::string GetWXF();
protected:
private:
std::string _wxf;
int _pieceFiles[5] = {-1, -1, -1, -1, -1};
const std::map<PieceType, std::string> _pieceToWXF = {
{Pawn, "P"},
{Rook, "R"},
{Knight, "H"},
{Elephant, "E"},
{King, "G"},
{Silver, "A"},
{Cannon, "C"}
};
void CheckCannonDirection(const Piece *piece, int x, int y, Direction direction);
PieceType _initialSetup[10][9] = {
{ Rook, Knight, Elephant, Silver, King, Silver, Elephant, Knight, Rook },
{ None, None, None, None, None, None, None, None, None },
{ None, Cannon, None, None, None, None, None, Cannon, None },
{ Pawn, None, Pawn, None, Pawn, None, Pawn, None, Pawn },
{ None, None, None, None, None, None, None, None, None },
{ None, None, None, None, None, None, None, None, None },
{ Pawn, None, Pawn, None, Pawn, None, Pawn, None, Pawn },
{ None, Cannon, None, None, None, None, None, Cannon, None },
{ None, None, None, None, None, None, None, None, None },
{ Rook, Knight, Elephant, Silver, King, Silver, Elephant, Knight, Rook }
};
};