aboutsummaryrefslogtreecommitdiff
path: root/src/moves.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/moves.cpp')
-rw-r--r--src/moves.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/moves.cpp b/src/moves.cpp
index 9c7991a..5401e8b 100644
--- a/src/moves.cpp
+++ b/src/moves.cpp
@@ -6,7 +6,7 @@
#include "board.hpp"
#include "moves.hpp"
-void GenerateKnightMoves(Board *b, int from, std::vector<Move> &moves) {
+void GenerateKnightMoves(Game *b, int from, std::vector<Move> &moves) {
Piece knight = b->pieces[from];
if (knight.type != KNIGHT) {
@@ -34,7 +34,7 @@ void GenerateKnightMoves(Board *b, int from, std::vector<Move> &moves) {
moves.push_back({IndexToPosition(from), IndexToPosition(next)});
}
};
-void GeneratePawnMoves(Board *b, int from, std::vector<Move> &moves) {
+void GeneratePawnMoves(Game *b, int from, std::vector<Move> &moves) {
Piece pawn = b->pieces[from];
if (pawn.type != PAWN) {
assert(false && "Calling generate pawn moves on non pawn");
@@ -83,7 +83,7 @@ void GeneratePawnMoves(Board *b, int from, std::vector<Move> &moves) {
// the end
}
-std::vector<Move> GetPseudoLegalMoves(Board *b) {
+std::vector<Move> GetPseudoLegalMoves(Game *b) {
std::vector<Move> moves;
moves.reserve(50); // almost all position dont have that many moves
@@ -123,12 +123,12 @@ std::vector<Move> GetPseudoLegalMoves(Board *b) {
return moves;
}
-std::vector<Move> GetLegalMoves(Board *b) {
+std::vector<Move> GetLegalMoves(Game *b) {
std::vector<Move> moves = GetPseudoLegalMoves(b);
std::vector<Move> legalMove;
for (Move move : moves) {
bool isLegal = true;
- Board testBoard = *b;
+ Game testBoard = *b;
PlayMove(move, &testBoard);
auto opponentResponse = GetPseudoLegalMoves(&testBoard);
for (Move move : opponentResponse) {
@@ -143,7 +143,7 @@ std::vector<Move> GetLegalMoves(Board *b) {
if (legalMove.size() == 0) {
bool isCheck = false;
- Board testBoard = *b;
+ Game testBoard = *b;
auto opponentResponse = GetPseudoLegalMoves(&testBoard);
for (Move move : opponentResponse) {
if (testBoard.pieces[PositionToIndex(move.To)].type == KING) {
@@ -170,7 +170,7 @@ Position IndexToPosition(int i) {
return {rank, file};
}
-void GenerateSlidingMoves(Board *b, int from,
+void GenerateSlidingMoves(Game *b, int from,
const std::array<int, 4> &directions,
std::vector<Move> &moves) {
for (uint i = 0; i < directions.size(); i++) {
@@ -205,7 +205,7 @@ void GenerateSlidingMoves(Board *b, int from,
};
};
-void GenerateKingMoves(Board *b, int from, std::vector<Move> &moves) {
+void GenerateKingMoves(Game *b, int from, std::vector<Move> &moves) {
if (b->pieces[from].type != KING) {
assert(false && "calling generate king moves on non king");
return;