mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
add board size tests
These fail in a way that I think is unique to the curses app, so I'm not fixing them right away.
This commit is contained in:
parent
fcf1e49c16
commit
6f6714596a
2 changed files with 11 additions and 50 deletions
|
@ -297,8 +297,7 @@ class Device():
|
||||||
nPlayers = 1 + len(remote.guestNames)
|
nPlayers = 1 + len(remote.guestNames)
|
||||||
hostPosn = random.randint(0, nPlayers-1)
|
hostPosn = random.randint(0, nPlayers-1)
|
||||||
traySize = 0 == args.TRAY_SIZE and random.randint(7, 9) or args.TRAY_SIZE
|
traySize = 0 == args.TRAY_SIZE and random.randint(7, 9) or args.TRAY_SIZE
|
||||||
boardSize = args.BOARD_SIZE and args.BOARD_SIZE \
|
boardSize = random.choice(range(args.BOARD_SIZE_MIN, args.BOARD_SIZE_MAX+1, 2))
|
||||||
or 1 + (2 * (random.randint(11, 21)//2))
|
|
||||||
|
|
||||||
response = self._sendWaitReply('makeGame', nPlayers=nPlayers, hostPosn=hostPosn,
|
response = self._sendWaitReply('makeGame', nPlayers=nPlayers, hostPosn=hostPosn,
|
||||||
dict=args.DICTS[0], boardSize=boardSize,
|
dict=args.DICTS[0], boardSize=boardSize,
|
||||||
|
@ -739,8 +738,10 @@ def mkParser():
|
||||||
|
|
||||||
parser.add_argument('--force-tray', dest = 'TRAY_SIZE', default = 0, type = int,
|
parser.add_argument('--force-tray', dest = 'TRAY_SIZE', default = 0, type = int,
|
||||||
help = 'Always this many tiles per tray')
|
help = 'Always this many tiles per tray')
|
||||||
parser.add_argument('--board-size', dest = 'BOARD_SIZE', type = int, default = 0,
|
parser.add_argument('--board-size-min', dest = 'BOARD_SIZE_MIN', type = int, default = 11,
|
||||||
help = 'Use <n>x<n> size board')
|
help = 'give boards at least this many rows and columns')
|
||||||
|
parser.add_argument('--board-size-max', dest = 'BOARD_SIZE_MAX', type = int, default = 23,
|
||||||
|
help = 'give boards no more than this many rows and columns')
|
||||||
|
|
||||||
parser.add_argument('--rematch-level', dest = 'REMATCH_LEVEL', type = int, default = 0,
|
parser.add_argument('--rematch-level', dest = 'REMATCH_LEVEL', type = int, default = 0,
|
||||||
help = 'rematch games down to this ancestry/depth')
|
help = 'rematch games down to this ancestry/depth')
|
||||||
|
@ -771,6 +772,11 @@ def parseArgs():
|
||||||
|
|
||||||
def assignDefaults(args):
|
def assignDefaults(args):
|
||||||
if len(args.DICTS) == 0: args.DICTS.append('CollegeEng_2to8.xwd')
|
if len(args.DICTS) == 0: args.DICTS.append('CollegeEng_2to8.xwd')
|
||||||
|
assert 1 == (args.BOARD_SIZE_MAX % 2)
|
||||||
|
assert 1 == (args.BOARD_SIZE_MIN % 2)
|
||||||
|
assert args.BOARD_SIZE_MAX >= args.BOARD_SIZE_MIN
|
||||||
|
assert args.BOARD_SIZE_MIN >= 11
|
||||||
|
assert args.BOARD_SIZE_MAX <= 23
|
||||||
|
|
||||||
def termHandler(signum, frame):
|
def termHandler(signum, frame):
|
||||||
global gDone
|
global gDone
|
||||||
|
@ -783,8 +789,7 @@ def initLogs():
|
||||||
scriptName = os.path.splitext(os.path.basename(sys.argv[0]))[0]
|
scriptName = os.path.splitext(os.path.basename(sys.argv[0]))[0]
|
||||||
logdir = scriptName + '_logs'
|
logdir = scriptName + '_logs'
|
||||||
if os.path.exists(logdir):
|
if os.path.exists(logdir):
|
||||||
shutil.rmtree(logdir)
|
shutil.move(logdir, '/tmp/{}_{}'.format(logdir, os.getpid()))
|
||||||
# shutil.move(logdir, '/tmp/' + logdir + '_' + str(random.randint(0, 100000)))
|
|
||||||
os.mkdir(logdir)
|
os.mkdir(logdir)
|
||||||
|
|
||||||
logfilepath = '{}/{}_log.txt'.format(logdir, scriptName)
|
logfilepath = '{}/{}_log.txt'.format(logdir, scriptName)
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
COOKIE=$$
|
|
||||||
GUEST_COUNT=1
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
echo "usage: $0: \\"
|
|
||||||
echo " [-q] # quit after done \\"
|
|
||||||
echo " [-g <1..3>] # num guest devices; default: 1 \\"
|
|
||||||
exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
while [ -n "$1" ]; do
|
|
||||||
case $1 in
|
|
||||||
-q)
|
|
||||||
QUIT="-q 2"
|
|
||||||
;;
|
|
||||||
-g)
|
|
||||||
GUEST_COUNT=$2
|
|
||||||
if [ $GUEST_COUNT -lt 1 -o $GUEST_COUNT -gt 3 ]; then
|
|
||||||
usage
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
|
|
||||||
NUM=0 # not strictly needed....
|
|
||||||
for NAME in Kati Brynn Ariela; do
|
|
||||||
./obj_linux_memdbg/xwords -d dict.xwd -r $NAME -a localhost -p 10999 -C $COOKIE $QUIT &
|
|
||||||
|
|
||||||
REMOTES="$REMOTES -N"
|
|
||||||
NUM=$((NUM+1))
|
|
||||||
[ $NUM -ge $GUEST_COUNT ] && break
|
|
||||||
done
|
|
||||||
|
|
||||||
./obj_linux_memdbg/xwords -d dict.xwd -r Eric -s $REMOTES -a localhost -p 10999 -C $COOKIE $QUIT &
|
|
||||||
|
|
||||||
wait
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue