This commit is contained in:
2018-10-31 10:06:43 +01:00
parent e121c6f6dd
commit b3ad46d98a
39 changed files with 1757 additions and 1116 deletions

View File

@@ -53,6 +53,16 @@ then
echec
fi
#
# CHOISIR UNE METHODE2 AU HASARD
#
ROBOT=`ls $APPS_PATH/methode2 | shuf | tail -n 1`
debug $ROBOT
$APPS_PATH/methode2/robot.sh $ROBOT
succes
#
# CHOISIR UNE METHODE AU HASARD
#

91
scripts/blocks2.sh Executable file
View File

@@ -0,0 +1,91 @@
#!/bin/bash
lescript=`basename $0 .sh`
#
# TOOLS
#
function debug
{
if [ -f $FLAG_PATH/debug ]
then
echo $1
fi
}
function sortie
{
exit $1
}
function succes
{
debug "SUCCES"
sortie 0
}
function echec
{
debug "ECHEC"
exit 1
}
#
# PARAMETRES PAR FICHIER FLAGS
#
if [ -f $FLAG_PATH/no_blocks ]
then
debug "No blocks"
echec
fi
while IFS='' read -r line || [[ -n "$line" ]]; do
BLOCK=`echo $line | awk '{print $2}'`
HEIGHT=`echo $line | awk '{print $3}'`
NBTX=`echo $line | awk '{print $4}'`
#
# TEST DU FLAG
#
flag=$FLAG_PATH/bot_${lescript}_${BLOCK}.flag
if [ -f $flag ]
then
debug "${lescript}_${BLOCK} already done"
continue
fi
touch $flag
#
# CHOISIR UNE METHODE2 AU HASARD
#
for METHODE in `ls $APPS_PATH/methode2 | grep -v robot | shuf`
do
echo $METHODE
if [ ! -d $DATA_PATH/$METHODE ]
then
mkdir -p $DATA_PATH/$METHODE
fi
if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ]
then
cd $APPS_PATH/methode2
php robot.php $METHODE $BLOCK $((RANDOM % 6)) $2
if [ "$2" == "" ];
then
rm -f $DATA_PATH/hasard/$BLOCK.png
ln $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png
ln $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png
fi
fi
done
done < $DATA_PATH/block_list.txt
#
# List of finished blocks
#
rm -f $DATA_PATH/finished_block_list.txt
grep -v CACHE $DATA_PATH/block_list.txt >> $DATA_PATH/finished_block_list.txt
#
# SORTIE AVEC SUCCES
#
succes

View File

@@ -6,6 +6,8 @@ then
then
find $DATA_PATH -mtime +1 -type f -name *.png -exec rm -f {} \;
find $DATA_PATH -mtime +1 -type f -name *.zip -exec rm -f {} \;
find $TMP_PATH -mtime +3 -type f -name *.flag -exec rm -f {} \;
fi
else
if [ "$1" -eq "FULL" ]

View File

@@ -53,12 +53,14 @@ then
echec
fi
#
# Toujours placer la version HASHES
#
debug "Compute HASHES ..."
$APPS_PATH/methode/hashes/robot.sh
#
debug "Compute HASHES2HASHES ..."
$APPS_PATH/methode/hashes2hashes/robot.sh
#
# SORTIE AVEC SUCCES
#