{ "searchMode", ArgInt, (void *) &appData.searchMode, FALSE, (ArgIniType) 1 },
{ "stretch", ArgInt, (void *) &appData.stretch, FALSE, (ArgIniType) 1 },
{ "ignoreColors", ArgBoolean, (void *) &appData.ignoreColors, FALSE, FALSE },
+ { "findMirrorImage", ArgBoolean, (void *) &appData.findMirror, FALSE, FALSE },
#if ZIPPY
{ "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK },
int pieceList[256], quickBoard[256];
ChessSquare pieceType[256] = { EmptySquare };
-Board soughtBoard, reverseBoard;
+Board soughtBoard, reverseBoard, flipBoard, rotateBoard;
int counts[EmptySquare], minSought[EmptySquare], minReverse[EmptySquare], maxSought[EmptySquare], maxReverse[EmptySquare];
-Boolean epOK;
+Boolean epOK, flipSearch;
typedef struct {
unsigned char piece, to;
pieceList[piece] = to;
cnt++;
if(QuickCompare(soughtBoard, minSought, maxSought) ||
- appData.ignoreColors && QuickCompare(reverseBoard, minReverse, maxReverse)) {
+ appData.ignoreColors && QuickCompare(reverseBoard, minReverse, maxReverse) ||
+ flipSearch && (QuickCompare(flipBoard, minSought, maxSought) ||
+ appData.ignoreColors && QuickCompare(rotateBoard, minReverse, maxReverse))
+ ) {
static int lastCounts[EmptySquare+1];
int i;
if(stretch) for(i=0; i<EmptySquare; i++) if(lastCounts[i] != counts[i]) { stretch = 0; break; } // reset if material changes
InitSearch()
{
int r, f;
+ flipSearch = FALSE;
CopyBoard(soughtBoard, boards[currentMove]);
MakePieceList(soughtBoard, maxSought);
CopyBoard(reverseBoard, boards[currentMove]);
reverseBoard[r][f] = piece;
}
for(r=0; r<6; r++) reverseBoard[CASTLING][r] = boards[currentMove][CASTLING][(r+3)%6];
+ if(appData.findMirror && appData.searchMode <= 3 && (!nrCastlingRights
+ || (boards[currentMove][CASTLING][2] == NoRights ||
+ boards[currentMove][CASTLING][0] == NoRights && boards[currentMove][CASTLING][1] == NoRights )
+ && (boards[currentMove][CASTLING][5] == NoRights ||
+ boards[currentMove][CASTLING][3] == NoRights && boards[currentMove][CASTLING][4] == NoRights ) )
+ ) {
+ flipSearch = TRUE;
+ CopyBoard(flipBoard, soughtBoard);
+ CopyBoard(rotateBoard, reverseBoard);
+ for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) {
+ flipBoard[r][f] = soughtBoard[r][BOARD_WIDTH-1-f];
+ rotateBoard[r][f] = reverseBoard[r][BOARD_WIDTH-1-f];
+ }
+ }
for(r=0; r<BlackPawn; r++) maxReverse[r] = maxSought[r+BlackPawn], maxReverse[r+BlackPawn] = maxSought[r];
if(appData.searchMode >= 5) {
for(r=BOARD_HEIGHT/2; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) soughtBoard[r][f] = EmptySquare;
ApplyMove(fromX, fromY, toX, toY, promoChar, boards[scratch]);
if(PositionMatches(boards[scratch], boards[currentMove])) return plyNr;
if(appData.ignoreColors && PositionMatches(boards[scratch], reverseBoard)) return plyNr;
+ if(appData.findMirror) {
+ if(PositionMatches(boards[scratch], flipBoard)) return plyNr;
+ if(appData.ignoreColors && PositionMatches(boards[scratch], rotateBoard)) return plyNr;
+ }
}
}
int searchMode;
int stretch;
Boolean ignoreColors;
+ Boolean findMirror;
char *userName;
int rewindIndex; /* [HGM] autoinc */
int sameColorGames; /* [HGM] alternate */
#define OPT_Stretcht 1972\r
#define OPT_Reversed 1973\r
#define OPT_SearchMode 1974\r
+#define OPT_Mirror 1975\r
#define OPT_Bitmaps 1976\r
#define OPT_PieceFont 1977\r
#define OPT_MessageFont8 1978\r
PUSHBUTTON "Cancel",IDCANCEL,195,190,40,14\r
END\r
\r
-DLG_LoadOptions DIALOG DISCARDABLE 10, 18, 170, 248\r
+DLG_LoadOptions DIALOG DISCARDABLE 10, 18, 170, 261\r
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
CAPTION "Load Game Options"\r
FONT 8, "MS Sans Serif"\r
GROUPBOX "Search Mode: ",OPT_SearchMode,3,126,164,87,WS_GROUP\r
CONTROL "Also match reversed colors",OPT_Reversed,"Button",\r
BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,4,214,160,10\r
- PUSHBUTTON "OK",IDOK,56,229,50,14,WS_GROUP\r
- PUSHBUTTON "Cancel",IDCANCEL,112,229,50,14\r
+ CONTROL "Also match left-right miror image",OPT_Mirror,"Button",\r
+ BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,4,227,160,10\r
+ PUSHBUTTON "OK",IDOK,56,242,50,14,WS_GROUP\r
+ PUSHBUTTON "Cancel",IDCANCEL,112,242,50,14\r
END\r
\r
DLG_SaveOptions DIALOG DISCARDABLE 6, 17, 178, 119\r
SetDlgItemInt(hDlg, OPT_date, appData.dateThreshold, FALSE);\r
SetDlgItemInt(hDlg, OPT_Stretch, appData.stretch, FALSE);\r
CheckDlgButton(hDlg, OPT_Reversed, appData.ignoreColors);\r
+ CheckDlgButton(hDlg, OPT_Mirror, appData.findMirror);\r
switch (appData.searchMode) {\r
case 1:\r
CheckDlgButton(hDlg, OPT_Exact, TRUE);\r
appData.stretch = GetDlgItemInt(hDlg, OPT_Stretch, &ok, FALSE);\r
appData.searchMode = LoadOptionsWhichRadio(hDlg);\r
appData.ignoreColors = IsDlgButtonChecked(hDlg, OPT_Reversed);\r
+ appData.findMirror = IsDlgButtonChecked(hDlg, OPT_Mirror);\r
EndDialog(hDlg, TRUE);\r
return TRUE;\r
\r
{ 0, 0, 5000, NULL, (void*) &appData.eloThreshold1, "", NULL, Spin, N_("Elo of strongest player at least:") },
{ 0, 0, 5000, NULL, (void*) &appData.eloThreshold2, "", NULL, Spin, N_("Elo of weakest player at least:") },
{ 0, 0, 5000, NULL, (void*) &appData.dateThreshold, "", NULL, Spin, N_("No games before year:") },
+{ 0, 1, 50, NULL, (void*) &appData.stretch, "", NULL, Spin, N_("Minimum nr consecutive positions:") },
{ 1, 0, 180, NULL, (void*) &searchMode, (char*) modeNames, modeValues, ComboBox, N_("Seach mode:") },
{ 0, 0, 0, NULL, (void*) &appData.ignoreColors, "", NULL, CheckBox, N_("Also match reversed colors") },
-{ 0, 1, 50, NULL, (void*) &appData.stretch, "", NULL, Spin, N_("Minimum nr consecutive positions:") },
+{ 0, 0, 0, NULL, (void*) &appData.findMirror, "", NULL, CheckBox, N_("Also match left-right flipped position") },
{ 0, 0, 0, NULL, (void*) &LoadOptionsOK, "", NULL, EndMark , "" }
};