mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +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
|
||||||
#endif
|
#endif
|
||||||
searchComplete =
|
searchComplete =
|
||||||
engine_findMove( engine, model, selPlayer,
|
engine_findMove( engine, model, selPlayer, XP_FALSE,
|
||||||
tiles, nTiles, usePrev,
|
tiles, nTiles, usePrev,
|
||||||
#ifdef XWFEATURE_BONUSALL
|
#ifdef XWFEATURE_BONUSALL
|
||||||
allTilesBonus,
|
allTilesBonus,
|
||||||
|
|
|
@ -81,7 +81,7 @@ struct EngineCtxt {
|
||||||
const ModelCtxt* model;
|
const ModelCtxt* model;
|
||||||
const DictionaryCtxt* dict;
|
const DictionaryCtxt* dict;
|
||||||
XW_UtilCtxt* util;
|
XW_UtilCtxt* util;
|
||||||
XP_U16 turn;
|
XP_S16 turn;
|
||||||
|
|
||||||
Engine_rack rack;
|
Engine_rack rack;
|
||||||
Tile blankTile;
|
Tile blankTile;
|
||||||
|
@ -96,6 +96,7 @@ struct EngineCtxt {
|
||||||
XP_U16 star_row;
|
XP_U16 star_row;
|
||||||
XP_Bool returnNOW;
|
XP_Bool returnNOW;
|
||||||
XP_Bool isRobot;
|
XP_Bool isRobot;
|
||||||
|
XP_Bool includePending;
|
||||||
MoveIterationData miData;
|
MoveIterationData miData;
|
||||||
|
|
||||||
XP_S16 blankValues[MAX_TRAY_TILES];
|
XP_S16 blankValues[MAX_TRAY_TILES];
|
||||||
|
@ -375,8 +376,8 @@ normalizeIQ( EngineCtxt* engine, XP_U16 iq )
|
||||||
*/
|
*/
|
||||||
XP_Bool
|
XP_Bool
|
||||||
engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
XP_U16 turn, const Tile* tiles,
|
XP_S16 turn, XP_Bool includePending,
|
||||||
const XP_U16 nTiles, XP_Bool usePrev,
|
const Tile* tiles, const XP_U16 nTiles, XP_Bool usePrev,
|
||||||
#ifdef XWFEATURE_BONUSALL
|
#ifdef XWFEATURE_BONUSALL
|
||||||
XP_U16 allTilesBonus,
|
XP_U16 allTilesBonus,
|
||||||
#endif
|
#endif
|
||||||
|
@ -427,6 +428,7 @@ engine_findMove( EngineCtxt* engine, const ModelCtxt* model,
|
||||||
engine->model = model;
|
engine->model = model;
|
||||||
engine->dict = model_getPlayerDict( model, turn );
|
engine->dict = model_getPlayerDict( model, turn );
|
||||||
engine->turn = turn;
|
engine->turn = turn;
|
||||||
|
engine->includePending = includePending;
|
||||||
engine->usePrev = usePrev;
|
engine->usePrev = usePrev;
|
||||||
engine->blankTile = dict_getBlankTile( engine->dict );
|
engine->blankTile = dict_getBlankTile( engine->dict );
|
||||||
engine->returnNOW = XP_FALSE;
|
engine->returnNOW = XP_FALSE;
|
||||||
|
@ -763,9 +765,8 @@ localGetBoardTile( EngineCtxt* engine, XP_U16 col, XP_U16 row,
|
||||||
row = tmp;
|
row = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( model_getTile( engine->model, col, row, XP_FALSE,
|
if ( model_getTile( engine->model, col, row, engine->includePending,
|
||||||
0, /* don't get pending, so turn doesn't matter */
|
engine->turn, &result, &isBlank, NULL, NULL ) ) {
|
||||||
&result, &isBlank, NULL, NULL ) ) {
|
|
||||||
if ( isBlank && substBlank ) {
|
if ( isBlank && substBlank ) {
|
||||||
result = engine->blankTile;
|
result = engine->blankTile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,8 @@ void engine_reset( EngineCtxt* ctxt );
|
||||||
void engine_destroy( EngineCtxt* ctxt );
|
void engine_destroy( EngineCtxt* ctxt );
|
||||||
|
|
||||||
XP_Bool engine_findMove( EngineCtxt* ctxt, const ModelCtxt* model,
|
XP_Bool engine_findMove( EngineCtxt* ctxt, const ModelCtxt* model,
|
||||||
XP_U16 turn, const Tile* tiles,
|
XP_S16 turn, XP_Bool includePending,
|
||||||
XP_U16 nTiles, XP_Bool usePrev,
|
const Tile* tiles, XP_U16 nTiles, XP_Bool usePrev,
|
||||||
#ifdef XWFEATURE_BONUSALL
|
#ifdef XWFEATURE_BONUSALL
|
||||||
XP_U16 allTilesBonus,
|
XP_U16 allTilesBonus,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -580,9 +580,12 @@ model_getDictionary( const ModelCtxt* model )
|
||||||
} /* model_getDictionary */
|
} /* model_getDictionary */
|
||||||
|
|
||||||
DictionaryCtxt*
|
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 ) {
|
if ( NULL == dict ) {
|
||||||
dict = model->vol.dict;
|
dict = model->vol.dict;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ void model_setDictionary( ModelCtxt* model, DictionaryCtxt* dict );
|
||||||
DictionaryCtxt* model_getDictionary( const ModelCtxt* model );
|
DictionaryCtxt* model_getDictionary( const ModelCtxt* model );
|
||||||
|
|
||||||
void model_setPlayerDicts( ModelCtxt* model, const PlayerDicts* dicts );
|
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 model_getTile( const ModelCtxt* model, XP_U16 col, XP_U16 row,
|
||||||
XP_Bool getPending, XP_S16 turn,
|
XP_Bool getPending, XP_S16 turn,
|
||||||
|
|
|
@ -882,7 +882,7 @@ makeRobotMove( ServerCtxt* server )
|
||||||
#endif
|
#endif
|
||||||
XP_ASSERT( !!server_getEngineFor( server, turn ) );
|
XP_ASSERT( !!server_getEngineFor( server, turn ) );
|
||||||
searchComplete = engine_findMove( 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,
|
tileSet->nTiles, XP_FALSE,
|
||||||
#ifdef XWFEATURE_BONUSALL
|
#ifdef XWFEATURE_BONUSALL
|
||||||
allTilesBonus,
|
allTilesBonus,
|
||||||
|
|
Loading…
Add table
Reference in a new issue