Source

aichallenge-py / play_map.sh

Full commit
#!/bin/bash
#
#  play_map.sh
#

function usage() {
  echo 'Usage: play_map.sh <map_type>'
  exit 1
}

function in_debug_mode() {
  python << EOF
import settings
import sys
sys.exit(1 - int(settings.DEBUG))
EOF
  return $?
}

if [ $# -ne 1 ]; then
  usage
fi

map_name="$1"

debug_args=""
if in_debug_mode; then
  echo 'DEBUG mode -- longer turns allowed'
  debug_args="--loadtime 10000 --turntime 10000"
fi

case "${map_name}" in
  large)
    python tools/playgame.py "python MyBot.py" "python tools/sample_bots/python/HunterBot.py" --fill --map_file tools/maps/multi_hill_maze/maze_08p_01_fix.map --log_dir game_logs --turns 200 --scenario --food random --player_seed 7 --verbose -e ${debug_args}
    ;;
  small)
    python tools/playgame.py "python MyBot.py" "python tools/sample_bots/python/HunterBot.py" --fill --map_file tools/maps/example/tutorial1.map --log_dir game_logs --turns 60 --scenario --food none --player_seed 7 --verbose -e ${debug_args}
    ;;
  *)
    printf 'Unknown map "%s"\n' $1
    ;;
esac