// chess.cpp #include "windows.h" #include "dsdll.h" #include using namespace std; int moveCounter = 0; string lastMove = " "; string enpassantCapture = " "; //2 letter square name of enpassant capture string moves[1000] = { " " }; string enpassant[48] = { "a2a4", "b4a3", "b4a3", "b2b4", "a4b3", "c4b3", "c2c4", "b4c3", "d4c3", "d2d4", "c4d3", "e4d3", "e2e4", "d4e3", "f4e3", "f2f4", "e4f3", "g4f3", "g2g4", "f4g3", "h4g3", "h2h4", "g4h3", "g4h3", "a7a5", "b5a6", "b5a6", "b7b5", "a5b6", "c5b6", "c7c5", "b5c6", "d5c6", "d7d5", "c5d6", "e5d6", "e7e5", "d5e6", "f5e6", "f7f5", "e5f6", "g5f6", "g7g5", "f5g6", "h5g6", "h7h5", "g5h6", "g5h6" }; //lastmove BOOL APIENTRY DllMain( HANDLE, DWORD, LPVOID ) { return TRUE; } // Class class chess { FEX static const char* Bar( void ) { return ( "Hello World!\n" ); } FEX void writeMove( string move ) { moves[moveCounter] = move; moveCounter++; return; } FEX string checkEnpassant( string move ) { enpassantCapture = " "; if (moveCounter > 0) //if this isnt the games first move... { lastMove = moves[moveCounter - 1]; for (int i=0; i<48; i+=3 ) { if ( lastMove == enpassant[i] ) { if ( (move == enpassant[i+1]) || (move == enpassant[i+2]) ) { enpassantCapture = lastMove.substr(2,2); break; } } } } return ( enpassantCapture ); } };