Skip to content

Commit

Permalink
random seedをstart.shの引数から指定できるようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
seigot committed Aug 9, 2021
1 parent 7925e1e commit 9294177
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ IS_MANUAL_CONTROLL="n"
IS_SAMPLE_CONTROLL="n"
GAME_TIME="180" # game time (s)
RESULT_LOG_JSON="result.json" # result log file
INPUT_RAMDOM_SEED="" # random seed

## get args level setting
while getopts l:m:s:t:f: OPT
while getopts l:m:s:t:f:r: OPT
do
case $OPT in
"l" ) VALUE_L="$OPTARG" ;;
"m" ) IS_MANUAL_CONTROLL="$OPTARG" ;;
"s" ) IS_SAMPLE_CONTROLL="$OPTARG" ;;
"t" ) GAME_TIME="$OPTARG" ;;
"f" ) RESULT_LOG_JSON="$OPTARG" ;;
"r" ) INPUT_RAMDOM_SEED="$OPTARG" ;;
esac
done
echo "level: $VALUE_L"
Expand All @@ -34,6 +36,11 @@ case $VALUE_L in
"3" ) RANDOM_SEED="-1"; OBSTACLE_HEIGHT="10"; OBSTACLE_PROBABILITY="40"; ;;
* ) echo "invalid level: $VALUE_L"; exit 1;;
esac

if [ ! -z ${INPUT_RAMDOM_SEED} ]; then
# fix random seed from given value.
RANDOM_SEED=${INPUT_RAMDOM_SEED}
fi
echo "game_time: $GAME_TIME"
echo "RANDOM_SEED: $RANDOM_SEED"
echo "OBSTACLE_HEIGHT: ${OBSTACLE_HEIGHT}"
Expand Down

0 comments on commit 9294177

Please sign in to comment.