Piece: expanding getLegalMoves for Queen/Knight/Bishop
This commit is contained in:
parent
e5a124d193
commit
6773da28fb
4 changed files with 70 additions and 5 deletions
|
|
@ -13,6 +13,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include "Piece.hpp"
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ public:
|
|||
std::vector<std::vector<std::unique_ptr<Piece>>> boardGrid;
|
||||
Board();
|
||||
virtual ~Board();
|
||||
|
||||
void setupInitialPosition();
|
||||
std::unique_ptr<Piece> &getPieceAt(Square square);
|
||||
void movePiece(Square from, Square to);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#ifndef PIECE_HPP
|
||||
#define PIECE_HPP
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
|
|
@ -115,6 +114,13 @@ class King : public Piece {
|
|||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void setCastleQS(bool canCastle) {
|
||||
canCastleQS = canCastle;
|
||||
}
|
||||
void setCastleKS(bool canCastle) {
|
||||
canCastleKS = canCastle;
|
||||
}
|
||||
protected:
|
||||
bool canCastleQS = true;
|
||||
bool canCastleKS = true;
|
||||
|
|
@ -179,6 +185,10 @@ class Pawn : public Piece {
|
|||
pieceType = PAWN;
|
||||
}
|
||||
virtual std::vector<Move> getLegalMoves(const Square &from, Board &board) const override;
|
||||
void promote(const Square &promotionSquare, Board &board, PieceType promoteTo);
|
||||
protected:
|
||||
bool vulnEnPassant = false;
|
||||
bool firstMove = true;
|
||||
};
|
||||
#endif // PIECE_HPP
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue