mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
bug: comparison was dropping words with the same score as all those
already cached.
This commit is contained in:
parent
51f7adb650
commit
8d84b41596
1 changed files with 11 additions and 9 deletions
|
@ -1156,25 +1156,27 @@ saveMoveIfQualifies( EngineCtxt* engine, PossibleMove* posmove )
|
|||
static XP_Bool
|
||||
scoreQualifies( EngineCtxt* engine, XP_U16 score )
|
||||
{
|
||||
XP_Bool qualifies = XP_FALSE;
|
||||
|
||||
if ( (score > engine->miData.lastSeenMove.score)
|
||||
|| (score > engine->targetScore)
|
||||
|| (score < engine->miData.lowestSavedScore) ) {
|
||||
return XP_FALSE;
|
||||
/* do nothing */
|
||||
} else {
|
||||
XP_S16 i;
|
||||
/* Look at each saved score, and return true as soon as one's found
|
||||
with a lower score than this. <eeh> As an optimization, consider
|
||||
remembering what the lowest score is *once there are
|
||||
NUM_SAVED_MOVES moves in here* and doing a quick test on that. */
|
||||
with a lower or equal score to this. <eeh> As an optimization,
|
||||
consider remembering what the lowest score is *once there are
|
||||
NUM_SAVED_MOVES moves in here* and doing a quick test on that. Or
|
||||
better, keeping the list in sorted order. */
|
||||
for ( i = engine->isRobot? 0: NUM_SAVED_MOVES-1; i >= 0; --i ) {
|
||||
if ( score > engine->miData.savedMoves[i].score ) {
|
||||
/* <eeh> We could cache the value of i to know when to start
|
||||
the saveMoveIfQualifies search that's upcomming. */
|
||||
return XP_TRUE;
|
||||
if ( score >= engine->miData.savedMoves[i].score ) {
|
||||
qualifies = XP_TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return XP_FALSE;
|
||||
}
|
||||
return qualifies;
|
||||
} /* scoreQualifies */
|
||||
|
||||
static array_edge*
|
||||
|
|
Loading…
Reference in a new issue