Commit 7d267ac1 authored by alaskalinuxuser's avatar alaskalinuxuser
Browse files

added movpos castle input.

parent 63b16ba7
......@@ -64,6 +64,33 @@ vector<string> sepVect = split(boardPositions, ' ');
{ m_enPassant = false;} else { m_enPassant = true;}
m_moveSince = stoi (sepVect[6]);
m_turnCount = stoi (sepVect[7]);
/* If also has moves after fen....
if (sepVect.size() > 7) {
if (sepVect[8] == "moves"){
cout << "moves" << endl;
int l = sepVect.size();
for (int k = 9; k < l; k++) {
int first =((sepVect[k].at(0) - 'a' + 1) + (((sepVect[k].at(1) - '1') * 8) - 1));
int second =((sepVect[k].at(2) - 'a' + 1) + (((sepVect[k].at(3) - '1') * 8) - 1));
m_theBoard[second] = m_theBoard[first];
if (sepVect[k].size() == 5) {
char newPiece = '-';
if (!m_whitesTurn) {
newPiece = tolower(sepVect[k].at(4));
} else {
newPiece = toupper(sepVect[k].at(4));
}
m_theBoard[second] = newPiece;
}
m_theBoard[first] = '-';
if (first == 4) {m_Kcastle = false; m_Qcastle = false;}
if (first == 60) {m_kcastle = false; m_qcastle = false;}
// How to handle enPassant?
m_whitesTurn = !m_whitesTurn;
m_turnCount = k/2 - 0.5;
}
}// end moves setup.
}// end greater than 7 vectors. */
cout << "Position Set...." << endl;
} // End FEN
else if (sepVect[1] == "startpos")
......@@ -100,6 +127,27 @@ vector<string> sepVect = split(boardPositions, ' ');
}
m_theBoard[second] = newPiece;
}
if (m_theBoard[first] == 'k' || m_theBoard[first] == 'K'){
cout << "King Move" << endl;
if (first == 4 && second == 6) {
// White Castles King Side
m_theBoard[7] = '-';
m_theBoard[5] = 'R';cout << "castleWKS" << endl;
} else if (first == 4 && second == 2) {
// White Castles Queen Side
m_theBoard[0] = '-';
m_theBoard[3] = 'R';cout << "castleWQS" << endl;
} else if (first == 60 && second == 62) {
// Black Castles King Side
m_theBoard[63] = '-';
m_theBoard[61] = 'r';cout << "castleBKS" << endl;
} else if (first == 60 && second == 58) {
// Black Castles Queen Side
m_theBoard[56] = '-';
m_theBoard[59] = 'r';cout << "castleBQS" << endl;
}
} // Not a king move.....
m_theBoard[first] = '-';
if (first == 4) {m_Kcastle = false; m_Qcastle = false;}
if (first == 60) {m_kcastle = false; m_qcastle = false;}
......
No preview for this file type
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment