From: H.G. Muller Date: Wed, 17 Aug 2011 20:55:21 +0000 (+0200) Subject: Implement flipped search X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1f070c3ba500547459ad3df71fbdbad1e5b4b4a0;p=xboard.git Implement flipped search --- diff --git a/args.h b/args.h index d3b2d70..d7a77a2 100644 --- a/args.h +++ b/args.h @@ -641,6 +641,7 @@ ArgDescriptor argDescriptors[] = { { "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 }, diff --git a/backend.c b/backend.c index e670eaf..7ffbd84 100644 --- a/backend.c +++ b/backend.c @@ -11180,9 +11180,9 @@ PositionMatches(Board b1, Board b2) 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; @@ -11323,7 +11323,10 @@ int QuickScan(Board board, Move *move) 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= 5) { for(r=BOARD_HEIGHT/2; r