From b3de3fc91e29f70bde349e476bc9d85e75b4eb8c Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 10 Jan 2011 18:18:35 -0800 Subject: [PATCH 1/2] add --robot-iq param for testing --- xwords4/linux/scripts/discon_ok2.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xwords4/linux/scripts/discon_ok2.sh b/xwords4/linux/scripts/discon_ok2.sh index f3624f767..55b213fc7 100755 --- a/xwords4/linux/scripts/discon_ok2.sh +++ b/xwords4/linux/scripts/discon_ok2.sh @@ -105,9 +105,9 @@ build_cmds() { LOG=${LOGDIR}/${GAME}_${DEV}_LOG.txt touch $LOG # so greps won't show errors CMD="./obj_linux_memdbg/xwords --room $ROOM" - CMD="$CMD --robot ${NAMES[$DEV]} $OTHERS" - CMD="$CMD --dict=$DICT --port=$PORT --host=$HOST --file=$FILE " - CMD="$CMD --slow-robot 1:3 $PLAT_PARMS" + CMD="$CMD --robot ${NAMES[$DEV]} --robot-iq=$((1 + (RANDOM%100))) " + CMD="$CMD $OTHERS --dict=$DICT --port=$PORT --host=$HOST " + CMD="$CMD --file=$FILE --slow-robot 1:3 $PLAT_PARMS" CMD="$CMD $PUBLIC" CMDS[$COUNTER]=$CMD FILES[$COUNTER]=$FILE From 2b502a39c643a3909f9066f88eab8d864685a1fb Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 10 Jan 2011 18:19:10 -0800 Subject: [PATCH 2/2] fix mod-by-zero error when iq == 2 --- xwords4/common/engine.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xwords4/common/engine.c b/xwords4/common/engine.c index 43b88417d..ae85b2fd0 100644 --- a/xwords4/common/engine.c +++ b/xwords4/common/engine.c @@ -392,7 +392,10 @@ normalizeIQ( EngineCtxt* engine, XP_U16 iq ) engine->nMovesToSave = 1; } else { XP_U16 count = NUM_SAVED_ENGINE_MOVES * iq / 100; - engine->nMovesToSave = 1 + (XP_RANDOM() % count); + engine->nMovesToSave = 1; + if ( count > 0 ) { + engine->nMovesToSave += XP_RANDOM() % count; + } } XP_LOGF( "%s: set nMovesToSave=%d (iq=%d; NUM_SAVED_ENGINE_MOVES=%d)", __func__, engine->nMovesToSave, iq, NUM_SAVED_ENGINE_MOVES );