King: finalizing check detection and getLegalMoves()

This commit is contained in:
A.M. Rowsell 2025-08-27 14:22:26 -04:00
commit 22ac250f70
Signed by untrusted user who does not match committer: amr
GPG key ID: E0879EDBDB0CA7B1
4 changed files with 38 additions and 13 deletions

View file

@ -7,6 +7,7 @@
// defined by the Mozilla Public License, v. 2.0.
#include "Board.hpp"
#include "inc/strFuncs.hpp"
/*
* This is how the chessboard is organized in memory
@ -85,6 +86,21 @@ void Board::setupInitialPosition() {
return;
}
int setupFromFEN(std::string strFEN) {
std::string field1, field2, field3, field4, field5, field6;
std::vector<std::string> splitFEN = split(strFEN, ' ');
if(splitFEN.size() != 6) { // a valid FEN *must* contain 6 fields
return -1;
}
field1 = splitFEN[0];
field2 = splitFEN[1];
field3 = splitFEN[2];
field4 = splitFEN[3];
field5 = splitFEN[4];
field6 = splitFEN[5];
return 0;
}
void Board::movePiece(Square from, Square to) {
return;
}