### Basic pawn moves, sans en passant

parent d1aa2008
 ... ... @@ -863,6 +863,62 @@ string Moves::bishopMovesB(string boardPositions, int i) { } return list; } // End black king moves. string Moves::pawnMovesB(string boardPositions, int i) { string list = ""; vector theseMoves; string moveSquare; string theBoard = boardPositions; bool turn = false; int rowNum = i/8; int colNum = i%8; int k = i - 16; if (rowNum == 6) { // The standard catch for moving two spaces forward. if (theBoard[i-8] == '-' && theBoard[i-16] == '-') { theseMoves.push_back(k); } } // The standard catch for moving one space forward. k = i - 8; if (theBoard[k] == '-') { theseMoves.push_back(k); } k = i - 9;// Attacking to the left and down. if (colNum > 0 && isupper(theBoard[k])) { theseMoves.push_back(k); } k = i - 7;// Attacking to the right and down. if (colNum < 7 && isupper(theBoard[k])) { theseMoves.push_back(k); } // End boring pawn moves. // Need en passant moves // for(int l=0; (unsigned)l theseMoves; string moveSquare; string theBoard = boardPositions; bool turn = true; int rowNum = i/8; int colNum = i%8; int k = i + 16; cout << rowNum << endl; if (rowNum == 1) { // The standard catch for moving two spaces forward. if (theBoard[i+8] == '-' && theBoard[i+16] == '-') { theseMoves.push_back(k); } } // The standard catch for moving one space forward. k = i + 8; if (theBoard[k] == '-') { theseMoves.push_back(k); } k = i + 7;// Attacking to the left and up. if (colNum > 0 && islower(theBoard[k])) { theseMoves.push_back(k); } k = i + 9;// Attacking to the right and up. if (colNum < 7 && islower(theBoard[k])) { theseMoves.push_back(k); } // End boring pawn moves. // Need en passant moves // for(int l=0; (unsigned)l
 ... ... @@ -54,7 +54,10 @@ public: string kingMovesB(string boardPositions, int i); // white king moves: string kingMoves(string boardPositions, int i); // Black pawn moves: string pawnMovesB(string boardPositions, int i); // white pawn moves: string pawnMoves(string boardPositions, int i); };
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!