From 0bf16e3ab59f0dd1554288cbec0659f10d8d1155 Mon Sep 17 00:00:00 2001 From: MEUNIER Thibaud Date: Sun, 21 Aug 2022 09:30:06 +0200 Subject: [PATCH] enlever le hasard --- blockchain/inc/block.php | 2 +- methode2.tgz | Bin 0 -> 10078 bytes methode2/circle/draw.php | 21 +--- methode2/circle_line/draw.php | 20 +--- methode2/circle_spline/draw.php | 19 +--- methode2/circles/draw.php | 17 +-- methode2/circles_spline/draw.php | 19 +--- methode2/mondrian/draw.php | 2 +- methode2/peigne/draw.php | 19 +--- methode2/peignealpha/draw.php | 23 +--- methode2/robot.php | 8 +- methode2/splinelineblack/draw.php | 2 +- methode2/splinelineblackalpha/draw.php | 16 +-- methode2/splinelinegradient/draw.php | 19 +--- methode2/splinelinegradientalpha/draw.php | 21 +--- scripts/blocks2.sh | 6 +- scripts/blocks3.sh | 121 ++++++++++++++++++++++ 17 files changed, 161 insertions(+), 174 deletions(-) create mode 100644 methode2.tgz create mode 100755 scripts/blocks3.sh diff --git a/blockchain/inc/block.php b/blockchain/inc/block.php index a3026ac..f24e9e2 100644 --- a/blockchain/inc/block.php +++ b/blockchain/inc/block.php @@ -586,7 +586,7 @@ class blockchain ]; $color = $couleur; - if (($color == -1) || ($color > (count($color_tab)-1))) $color = rand(0,count($color_tab)-1); + if (($color == -1) || ($color > (count($color_tab)-1))) $color = $the_block->nonce % count($color_tab); // Rajout des HASHES $white = imagecolorallocate($vImage, 254, 254, 254); diff --git a/methode2.tgz b/methode2.tgz new file mode 100644 index 0000000000000000000000000000000000000000..38bb681d5b9ba81514c7d38b6ed35204693d63e0 GIT binary patch literal 10078 zcmZvBMO2&(uq;k+_uwwUg1fs1hoHeNK!U^I1h?Q2EVvC4G`PD52tfyTpTXw4|GlfX zc$?}v)tg?`sX9#?{{|sq5z!U_`RwDV&$>w3jE6L;SWN=6S(8fK_XW>A(HY6+|tEPK?=>ggCFy1a4^%sK^V&(>x zHpkiFwP_27ZOG7n5w!BcUd6Kt7UpX(+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Ic*=PP>6rt@{!Hs>>W-3rA9_qW5~6aFi71Q%T5jCPqJkDh_nKM9MY z!d&r7ZS>ch(zZMdOz%17}KIIGOPfpOSWiv3Vm8-)Ch>qV1K>^i>mxd($*UY3 zbvA%fs?XnHtgu^&l055-Nsy9b5Bh zSV(lu??0@?`KTVeUu3WR%^gBkQ13yma-H|3wJB^o4H#Sh6UQ8yu@8!55kP-2ii0)K z0cN0^S-_b&^mZ2rowXzYFd{?gfXOs`pgEKH3Z$EIhpKA%|A8$i!*O7o{^d?5df|pL vaXNdRoLK@CTdvMUz4B{!whmSZ`i`y&eH5|Y{{zzIPtpZ`)O`r;hzS1!y$K|m literal 0 HcmV?d00001 diff --git a/methode2/circle/draw.php b/methode2/circle/draw.php index 9fd205b..ea6f3de 100644 --- a/methode2/circle/draw.php +++ b/methode2/circle/draw.php @@ -29,35 +29,22 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB']; if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB']; - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Dégradé de 360 couleurs entre la couleur de dessin et le blanc - $vColor = getGDcolorGradientArray($vImage, 360, $couleurRGB, $fondRGB, $alpha); + $nbColor = 360; + $vColor = getGDcolorGradientArray($vImage, $nbColor, $vBgRGB, $vFgRGB, $alpha); // Récup des données $data = blockchain::getTransactionData($the_block, $type); - $n_data = count($data); $xc = $x + ($width / 2); $yc = $y + ($height / 2); foreach($data as $transaction) { - for($i=0;$i<360;$i++) + for($i=0;$i<$nbColor;$i++) { $valeur = hexdec($transaction['hash'][$i%TX_HASH_LEN]); if ($valeur != 0) $valeur += $valeur - 8; diff --git a/methode2/circle_line/draw.php b/methode2/circle_line/draw.php index b165e19..0917dba 100644 --- a/methode2/circle_line/draw.php +++ b/methode2/circle_line/draw.php @@ -29,24 +29,11 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB']; if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB']; - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Dégradé de 360 couleurs entre la couleur de dessin et le blanc - $vColor = getGDcolorGradientArray($vImage, 360, $couleurRGB, $fondRGB, $alpha); + $vColor = getGDcolorGradientArray($vImage, 360, $vBgRGB, $vBgRGB, $alpha); // Récup des données $data = blockchain::getTransactionData($the_block, $type); @@ -63,7 +50,8 @@ function DrawBlock($the_block, $vImage, $parametres) for($i=0;$i 5) $coef = 0.3; if ($c > 7) $coef = 0.8; if ($c > 9) $coef = 1.2; diff --git a/methode2/circles/draw.php b/methode2/circles/draw.php index b21e90a..bacb50f 100644 --- a/methode2/circles/draw.php +++ b/methode2/circles/draw.php @@ -29,24 +29,11 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB']; if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB']; - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Dégradé de 360 couleurs entre la couleur de dessin et le blanc - $vColor = getGDcolorGradientArray($vImage, 360, $couleurRGB, $fondRGB, $alpha); + $vColor = getGDcolorGradientArray($vImage, 360, $vBgRGB, $vFgRGB, $alpha); // Récup des données $data = blockchain::getTransactionData($the_block, $type); diff --git a/methode2/circles_spline/draw.php b/methode2/circles_spline/draw.php index f31ced6..613056b 100644 --- a/methode2/circles_spline/draw.php +++ b/methode2/circles_spline/draw.php @@ -28,21 +28,8 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB']; if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB']; - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Récup des données $data = blockchain::getTransactionData($the_block, $type); @@ -66,7 +53,7 @@ function DrawBlock($the_block, $vImage, $parametres) if ($nb < 5) $alpha = 0; // Dégradé de 360 couleurs entre la couleur de dessin et le blanc - $vColor = getGDcolorGradientArray($vImage, 360, $couleurRGB, $fondRGB, $alpha); + $vColor = getGDcolorGradientArray($vImage, 360, $vBgRGB, $vFgRGB, $alpha); // Le rayon du cercle dépend du montant de la transaction //$r0 = $width / 3; @@ -97,7 +84,7 @@ function DrawBlock($the_block, $vImage, $parametres) // Un coef aléatoire $coef = 0.1; - $c = rand(0,10); + $c = $transaction['value']%10; if ($c > 5) $coef = 0.3; if ($c > 7) $coef = 0.8; if ($c > 9) $coef = 1.2; diff --git a/methode2/mondrian/draw.php b/methode2/mondrian/draw.php index 4aac6d4..e902206 100644 --- a/methode2/mondrian/draw.php +++ b/methode2/mondrian/draw.php @@ -53,7 +53,7 @@ function DrawBlock($the_block, $vImage, $parametres) //if (($x2 - $x1) < ($width*0.015)) break; //if (($y2 - $y1) < ($height*0.015)) break; - $factor=rand(0,100); + $factor=$the_block->nonce % 100; // Je triche: les petits rectangle sont blancs if (($x2 - $x1) < 6) $factor=90; if (($y2 - $y1) < 6) $factor=90; diff --git a/methode2/peigne/draw.php b/methode2/peigne/draw.php index c9d16c2..b086c1c 100644 --- a/methode2/peigne/draw.php +++ b/methode2/peigne/draw.php @@ -28,28 +28,15 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB']; if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB']; - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Dégradé de 256 couleurs entre la couleur de fond et la couleur de dessin $nb_colors = 256; $vColor = array(); $hex_val = array( - ColorGradient::rgb2hex($couleurRGB), - ColorGradient::rgb2hex($fondRGB) + ColorGradient::rgb2hex($vBgRGB), + ColorGradient::rgb2hex($vFgRGB) ); $gradient = ColorGradient::gradient($hex_val[0], $hex_val[1], $nb_colors); for($i=0;$i<$nb_colors;$i++) diff --git a/methode2/peignealpha/draw.php b/methode2/peignealpha/draw.php index a722674..bd3c337 100644 --- a/methode2/peignealpha/draw.php +++ b/methode2/peignealpha/draw.php @@ -33,30 +33,17 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['iterations'])) $local_iterations = $parametres['iterations']; $facteur_max = 2.5 * ($height / GRAPH_HEIGHT); - - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - + // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Dégradé de 256 couleurs entre la couleur de fond et la couleur de dessin $alpha = 100; $nb_colors = 256; $vColor = array(); $hex_val = array( - ColorGradient::rgb2hex($couleurRGB), - ColorGradient::rgb2hex($fondRGB) + ColorGradient::rgb2hex($vBgRGB), + ColorGradient::rgb2hex($vFgRGB) ); $gradient = ColorGradient::gradient($hex_val[0], $hex_val[1], $nb_colors); for($i=0;$i<$nb_colors;$i++) @@ -148,7 +135,7 @@ function DrawBlock($the_block, $vImage, $parametres) if ($valeur != 0) { $decal = 15.0 * ($i / TX_HASH_LEN); - $valeur += rand(0, floor($decal)); + $valeur += floor($decal); $valeur /= 2; $valeur -= 8; $y0 = $h0 + ($valeur * $facteur); diff --git a/methode2/robot.php b/methode2/robot.php index b0a78b7..1c2254b 100644 --- a/methode2/robot.php +++ b/methode2/robot.php @@ -99,11 +99,11 @@ $parametres['font_RGB'] = $paramHeader[4]; $parametres['background_RGB'] = $paramHeader[5]; // Une chance sur deux d'inverser entre fg et bg -if (rand(0,100) < 50) { +if (($the_block->nonce%2)==1) { $parametres['background_color'] = $paramHeader[2]; - $parametres['background_RGB'] = $paramHeader[4]; - $parametres['font_color'] = $paramHeader[1]; - $parametres['font_RGB'] = $paramHeader[5]; + $parametres['background_RGB'] = $paramHeader[4]; + $parametres['font_color'] = $paramHeader[1]; + $parametres['font_RGB'] = $paramHeader[5]; } DrawBlock($the_block, $img, $parametres); diff --git a/methode2/splinelineblack/draw.php b/methode2/splinelineblack/draw.php index a18daaf..758288d 100644 --- a/methode2/splinelineblack/draw.php +++ b/methode2/splinelineblack/draw.php @@ -29,7 +29,7 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB']; // Forcer les couleurs - $hasard = rand(0,10); + $hasard = $the_block->nonce % 10; $couleur=3;$val=0; if ($hasard > $val++) $couleur = 5; if ($hasard > $val++) $couleur = 6; diff --git a/methode2/splinelineblackalpha/draw.php b/methode2/splinelineblackalpha/draw.php index 4abaccf..395c640 100644 --- a/methode2/splinelineblackalpha/draw.php +++ b/methode2/splinelineblackalpha/draw.php @@ -34,23 +34,9 @@ function DrawBlock($the_block, $vImage, $parametres) $facteur_max = 2.5 * ($height / GRAPH_HEIGHT); - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - $fondRGB=[0,0,0]; $fond=imagecolorallocate($vImage,$fondRGB[0],$fondRGB[1],$fondRGB[2]); $couleurRGB=[240,147,43]; - $couleur=imagecolorallocate($vImage,$couleurRGB[0],$couleurRGB[1],$couleurRGB[2]); // Remplir le fond imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); @@ -168,7 +154,7 @@ function DrawBlock($the_block, $vImage, $parametres) if ($valeur != 0) { $decal = 15.0 * ($i / TX_HASH_LEN); - $valeur += rand(0, floor($decal)); + $valeur += floor($decal); $valeur /= 2; $valeur -= 8; $y0 = $h0 + ($valeur * $facteur); diff --git a/methode2/splinelinegradient/draw.php b/methode2/splinelinegradient/draw.php index a2096a0..d432455 100644 --- a/methode2/splinelinegradient/draw.php +++ b/methode2/splinelinegradient/draw.php @@ -28,28 +28,15 @@ function DrawBlock($the_block, $vImage, $parametres) if (isset($parametres['font_RGB'])) $vFgRGB = $parametres['font_RGB']; if (isset($parametres['background_RGB'])) $vBgRGB = $parametres['background_RGB']; - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Dégradé de 256 couleurs entre la couleur de fond et la couleur de dessin $nb_colors = 256; $vColor = array(); $hex_val = array( - ColorGradient::rgb2hex($couleurRGB), - ColorGradient::rgb2hex($fondRGB) + ColorGradient::rgb2hex($vBgRGB), + ColorGradient::rgb2hex($vFgRGB) ); $gradient = ColorGradient::gradient($hex_val[0], $hex_val[1], $nb_colors); for($i=0;$i<$nb_colors;$i++) diff --git a/methode2/splinelinegradientalpha/draw.php b/methode2/splinelinegradientalpha/draw.php index 4b4af99..a7cfa35 100644 --- a/methode2/splinelinegradientalpha/draw.php +++ b/methode2/splinelinegradientalpha/draw.php @@ -34,29 +34,16 @@ function DrawBlock($the_block, $vImage, $parametres) $facteur_max = 2.5 * ($height / GRAPH_HEIGHT); - // Une chance sur deux d'inverser entre fg et bg - if (rand(0,100) < 50) { - $fond = $vBgColor; - $couleur = $vFgColor; - $fondRGB = $vBgRGB; - $couleurRGB = $vFgRGB; - } else { - $fond = $vFgColor; - $couleur = $vBgColor; - $fondRGB = $vFgRGB; - $couleurRGB = $vBgRGB; - } - // Remplir le fond - imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $fond); + imagefilledrectangle($vImage, $x+($marge_x/2), $y+($marge_y/2), $x+$width-+($marge_x/2), $y+$height-+($marge_y/2), $vFgColor); // Dégradé de 256 couleurs entre la couleur de fond et la couleur de dessin $alpha = 100; $nb_colors = 256; $vColor = array(); $hex_val = array( - ColorGradient::rgb2hex($couleurRGB), - ColorGradient::rgb2hex($fondRGB) + ColorGradient::rgb2hex($vBgRGB), + ColorGradient::rgb2hex($vFgRGB) ); $gradient = ColorGradient::gradient($hex_val[0], $hex_val[1], $nb_colors); for($i=0;$i<$nb_colors;$i++) @@ -148,7 +135,7 @@ function DrawBlock($the_block, $vImage, $parametres) if ($valeur != 0) { $decal = 15.0 * ($i / TX_HASH_LEN); - $valeur += rand(0, floor($decal)); + $valeur += floor($decal); $valeur /= 2; $valeur -= 8; $y0 = $h0 + ($valeur * $facteur); diff --git a/scripts/blocks2.sh b/scripts/blocks2.sh index b73cbc1..cbe54c1 100755 --- a/scripts/blocks2.sh +++ b/scripts/blocks2.sh @@ -91,15 +91,11 @@ while IFS='' read -r line || [[ -n "$line" ]]; do then php robot.php $METHODE $BLOCK $((RANDOM % 6)) $2 cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png + cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png fi done cd - >> /dev/null - if [ ! -f $DATA_PATH/hasard/$BLOCK.png ] - then - cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png - fi - if [ ! -f $DATA_PATH/nonce/$BLOCK.png ] then cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/nonce/$BLOCK.png diff --git a/scripts/blocks3.sh b/scripts/blocks3.sh new file mode 100755 index 0000000..1624292 --- /dev/null +++ b/scripts/blocks3.sh @@ -0,0 +1,121 @@ +#!/bin/bash +lescript=`basename $0 .sh` +flag=$TMP_PATH/bot_$lescript.flag + +# +# 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 + + NAME=`echo $line | awk '{print $1}'` + 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 + + if [ ! -f $DATA_PATH/nonce/$BLOCK.png ] + then + # + # Si c'est la première fois que l'on dessine le block + # On choisit la méthode qui découle du nonce + # + cd $APPS_PATH/nonce + nbmethodes=`cat $DATA_PATH/nonce_methods_list.txt | wc -l` + lenonce=`php robot.php $BLOCK` + lamethode=$((lenonce % nbmethodes)) + if [ $lamethode -eq 0 ] + then + lamethode=$nbmethodes + fi + LISTE_METHODE=`cat $DATA_PATH/nonce_methods_list.txt | head -n $lamethode | tail -1` + else + # + # CHOISIR UNE METHODE2 AU HASARD + # + LISTE_METHODE=`ls $APPS_PATH/methode2 | grep -v robot | shuf` + if [ $NBTX -lt 10 ] + then + LISTE_METHODE=`ls $APPS_PATH/methode2 | grep -v robot | grep -v treemap | grep -v mondrian | shuf` + fi + fi + + cd $APPS_PATH/methode2 + for METHODE in $LISTE_METHODE + do + if [ ! -d $DATA_PATH/$METHODE ] + then + mkdir -p $DATA_PATH/$METHODE + fi + echo $BLOCK $NAME $METHODE + if [ ! -f $DATA_PATH/$METHODE/$BLOCK.png ] + then + php robot.php $METHODE $BLOCK $((RANDOM % 6)) $2 + cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/$METHODE/$BLOCK.png + cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/hasard/$BLOCK.png + fi + done + cd - >> /dev/null + + if [ ! -f $DATA_PATH/nonce/$BLOCK.png ] + then + cp $DATA_PATH/last/$BLOCK.png $DATA_PATH/nonce/$BLOCK.png + fi + + rm -f $flag + +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