Commit fe1f7404 authored by alaskalinuxuser's avatar alaskalinuxuser
Browse files

Now recognizes EN Passant input.

parent 38698ec4
......@@ -102,7 +102,7 @@ vector<string> sepVect = split(boardPositions, ' ');
m_kcastle = true;
m_qcastle = true;
m_enPassant = false;
m_enPasPawn = "";
m_enPasPawn = ' ';
m_moveSince = 0;
m_turnCount = 0;
int j = stringBoard.length();
......@@ -118,6 +118,50 @@ vector<string> sepVect = split(boardPositions, ' ');
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 (m_enPassant){
if (m_theBoard[second] == 'p' && sepVect[k].at(1) == '4'){
if ((sepVect[k].at(1)-sepVect[k].at(3)) == 1){
if ((sepVect[k].at(2)-sepVect[k].at(0)) == 1){
m_theBoard[first-1] = '-';
}}
if ((sepVect[k].at(1)-sepVect[k].at(3)) == 1){
if ((sepVect[k].at(0)-sepVect[k].at(2)) == 1){
m_theBoard[first+1] = '-';
}}
cout << "EN PASSANT" << endl;
}
if (m_theBoard[second] == 'P' && sepVect[k].at(1) == '5'){
if ((sepVect[k].at(3)-sepVect[k].at(1)) == 1){
if ((sepVect[k].at(2)-sepVect[k].at(0)) == 1){
m_theBoard[first+1] = '-';
}}
if ((sepVect[k].at(3)-sepVect[k].at(1)) == 1){
if ((sepVect[k].at(0)-sepVect[k].at(2)) == 1){
m_theBoard[first-1] = '-';
}}
cout << "EN PASSANT" << endl;
}
}// End checking en passant.
m_enPassant = false; m_enPasPawn = ' ';
// EN PASSANT enabled
if (m_theBoard[second] == 'p'){
if ((sepVect[k].at(1)-sepVect[k].at(3)) == 2){
m_enPassant = true;
m_enPasPawn = sepVect[k].at(2);
// cout << "EN PASSANT enabled " << m_enPasPawn << endl;
}
}
if (m_theBoard[second] == 'P'){
if ((sepVect[k].at(3)-sepVect[k].at(1)) == 2){
m_enPassant = true;
m_enPasPawn = sepVect[k].at(2);
// cout << "EN PASSANT enabled " << m_enPasPawn << endl;
}
}
// End EN PASSANT enabled
if (sepVect[k].size() == 5) {
char newPiece = '-';
if (!m_whitesTurn) {
......
......@@ -17,7 +17,7 @@ private:
bool m_kcastle = true;
bool m_qcastle = true;
bool m_enPassant = false;
string m_enPasPawn = "";
char m_enPasPawn = ' ';
int m_moveSince = 0;
int m_turnCount = 0;
......
No preview for this file type
No preview for this file type
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