mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
change engine to optionally look at pending tiles
option not used ... yet
This commit is contained in:
parent
838d0e5cc2
commit
30fd27aa53
6 changed files with 18 additions and 14 deletions
|
@ -2180,7 +2180,7 @@ board_requestHint( BoardCtxt* board,
|
|||
# endif
|
||||
#endif
|
||||
searchComplete =
|
||||
engine_findMove( engine, model, selPlayer,
|
||||
engine_findMove( engine, model, selPlayer, XP_FALSE,
|
||||
tiles, nTiles, usePrev,
|
||||
#ifdef XWFEATURE_BONUSALL
|
||||
allTilesBonus,
|
||||
|
|
|
@ -81,7 +81,7 @@ struct EngineCtxt {
|
|||
const ModelCtxt* model;
|
||||
const DictionaryCtxt* dict;
|
||||
XW_UtilCtxt* util;
|
||||
XP_U16 turn;
|
||||
XP_S16 turn;
|
||||
|
||||
Engine_rack rack;
|
||||
Tile blankTile;
|
||||
|
@ -96,6 +96,7 @@ struct EngineCtxt {
|
|||
XP_U16 star_row;
|
||||
XP_Bool returnNOW;
|
||||
XP_Bool isRobot;
|
||||
XP_Bool includePending;
|
||||
MoveIterationData miData;
|
||||
|
||||
XP_S16 blankValues[MAX_TRAY_TILES];
|
||||
|
@ -375,8 +376,8 @@ normalizeIQ( EngineCtxt* engine, XP_U16 iq )
|
|||
*/
|
||||
XP_Bool
|
||||
engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||
XP_U16 turn, const Tile* tiles,
|
||||
const XP_U16 nTiles, XP_Bool usePrev,
|
||||
XP_S16 turn, XP_Bool includePending,
|
||||
const Tile* tiles, const XP_U16 nTiles, XP_Bool usePrev,
|
||||
#ifdef XWFEATURE_BONUSALL
|
||||
XP_U16 allTilesBonus,
|
||||
#endif
|
||||
|
@ -427,6 +428,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
|||
engine->model = model;
|
||||
engine->dict = model_getPlayerDict( model, turn );
|
||||
engine->turn = turn;
|
||||
engine->includePending = includePending;
|
||||
engine->usePrev = usePrev;
|
||||
engine->blankTile = dict_getBlankTile( engine->dict );
|
||||
engine->returnNOW = XP_FALSE;
|
||||
|
@ -763,9 +765,8 @@ localGetBoardTile( EngineCtxt* engine, XP_U16 col, XP_U16 row,
|
|||
row = tmp;
|
||||
}
|
||||
|
||||
if ( model_getTile( engine->model, col, row, XP_FALSE,
|
||||
0, /* don't get pending, so turn doesn't matter */
|
||||
&result, &isBlank, NULL, NULL ) ) {
|
||||
if ( model_getTile( engine->model, col, row, engine->includePending,
|
||||
engine->turn, &result, &isBlank, NULL, NULL ) ) {
|
||||
if ( isBlank && substBlank ) {
|
||||
result = engine->blankTile;
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ void engine_reset( EngineCtxt* ctxt );
|
|||
void engine_destroy( EngineCtxt* ctxt );
|
||||
|
||||
XP_Bool engine_findMove( EngineCtxt* ctxt, const ModelCtxt* model,
|
||||
XP_U16 turn, const Tile* tiles,
|
||||
XP_U16 nTiles, XP_Bool usePrev,
|
||||
XP_S16 turn, XP_Bool includePending,
|
||||
const Tile* tiles, XP_U16 nTiles, XP_Bool usePrev,
|
||||
#ifdef XWFEATURE_BONUSALL
|
||||
XP_U16 allTilesBonus,
|
||||
#endif
|
||||
|
|
|
@ -580,9 +580,12 @@ model_getDictionary( const ModelCtxt* model )
|
|||
} /* model_getDictionary */
|
||||
|
||||
DictionaryCtxt*
|
||||
model_getPlayerDict( const ModelCtxt* model, XP_U16 playerNum )
|
||||
model_getPlayerDict( const ModelCtxt* model, XP_S16 playerNum )
|
||||
{
|
||||
DictionaryCtxt* dict = model->vol.dicts.dicts[playerNum];
|
||||
DictionaryCtxt* dict = NULL;
|
||||
if ( 0 <= playerNum && playerNum < VSIZE(model->vol.dicts.dicts) ) {
|
||||
dict = model->vol.dicts.dicts[playerNum];
|
||||
}
|
||||
if ( NULL == dict ) {
|
||||
dict = model->vol.dict;
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ void model_setDictionary( ModelCtxt* model, DictionaryCtxt* dict );
|
|||
DictionaryCtxt* model_getDictionary( const ModelCtxt* model );
|
||||
|
||||
void model_setPlayerDicts( ModelCtxt* model, const PlayerDicts* dicts );
|
||||
DictionaryCtxt* model_getPlayerDict( const ModelCtxt* model, XP_U16 playerNum );
|
||||
DictionaryCtxt* model_getPlayerDict( const ModelCtxt* model, XP_S16 playerNum );
|
||||
|
||||
XP_Bool model_getTile( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||
XP_Bool getPending, XP_S16 turn,
|
||||
|
|
|
@ -882,7 +882,7 @@ makeRobotMove( ServerCtxt* server )
|
|||
#endif
|
||||
XP_ASSERT( !!server_getEngineFor( server, turn ) );
|
||||
searchComplete = engine_findMove( server_getEngineFor( server, turn ),
|
||||
model, turn, tileSet->tiles,
|
||||
model, turn, XP_FALSE, tileSet->tiles,
|
||||
tileSet->nTiles, XP_FALSE,
|
||||
#ifdef XWFEATURE_BONUSALL
|
||||
allTilesBonus,
|
||||
|
|
Loading…
Reference in a new issue