This repository has been archived on 2023-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
iaj/TP2/mk_stats.sh

53 lines
1.1 KiB
Bash
Raw Normal View History

2023-02-16 20:35:32 +01:00
#!/bin/sh
2023-03-29 14:37:17 +02:00
PRG_1=./rand_player
PRG_2=./mcts_player
2023-02-16 20:35:32 +01:00
GAME_DIR=new_stats
2023-04-11 15:20:40 +02:00
NB_GAMES_PER_SIDE=6
2023-02-16 20:35:32 +01:00
NBL=6
NBC=4
if [ -d ${GAME_DIR} ]
then
echo "GAME_DIR ever here"
exit 0
else
mkdir ${GAME_DIR}
fi
if [ ! -e ${PRG_1} ]
then
echo "PRG_1 is missing"
exit 0
fi
if [ ! -e ${PRG_2} ]
then
echo "PRG_2 is missing"
exit 0
fi
2023-02-16 20:46:54 +01:00
pike run_many_games.pike -f ${PRG_1} -s ${PRG_2} -o ${GAME_DIR} -n ${NB_GAMES_PER_SIDE} -l ${NBL} -c ${NBC} 2> ${GAME_DIR}/log1.txt 1>&2
pike run_many_games.pike -f ${PRG_2} -s ${PRG_1} -o ${GAME_DIR} -n ${NB_GAMES_PER_SIDE} -l ${NBL} -c ${NBC} 2> ${GAME_DIR}/log2.txt 1>&2
{
echo " ================"
echo " NB_GAMES_PER_SIDE ${NB_GAMES_PER_SIDE}"
echo " NBL ${NBL}"
echo " NBC ${NBC}"
echo ""
echo " number of wins"
echo " ================"
} > ${GAME_DIR}/resume.txt
2023-03-31 16:56:15 +02:00
STR_WIN1=$(printf "%s win" ${PRG_1})
2023-02-16 20:46:54 +01:00
NB_WIN1=$(grep -c "${STR_WIN1}" ${GAME_DIR}/scores.txt)
echo " ${PRG_1} is ${NB_WIN1}" >> ${GAME_DIR}/resume.txt
2023-03-31 16:56:15 +02:00
STR_WIN2=$(printf "%s win" ${PRG_2})
2023-02-16 20:46:54 +01:00
NB_WIN2=$(grep -c "${STR_WIN2}" ${GAME_DIR}/scores.txt)
{
echo " ${PRG_2} is ${NB_WIN2}"
echo " ================"
} >> ${GAME_DIR}/resume.txt