####################################################################################################################################### # # # G E N E R A T I O N D ' U N E F A M I L L E D ' A U T O M A T E S C E L L U L A I R E S # # B I D I M E N S I O N N E L S B I N A I R E S E L E M E N T A I R E S : # # # # # # Author of '$xiird/.AC2B.3.11.$U' : # # # # Jean-Francois Colonna (LACTAMME, AAAAMMJJhhmmss). # # # ####################################################################################################################################### $Z Suq $Z setParam _____FAutoCellB $xTV/AUTOMC.2B $Z setParam _____EdAutoCellB $NEXIST $Z # Ce parametre a ete introduit le 20030123082300, apres le passge de {N,B} a {B,W}... # $Z setParam _____CKadre $GRIS_4 $Z SETParam _____EKadre 1 $Z source $xci/AutoC_NDB$vv$Y $Z SETENV VchaineS $pS $Z SETENV VchaineN $pN $Z SETENV VchaineB $pB $c /* La modification du 20150612170520 a consiste a remplacer les variables '$chaine{SNB]' */ $c /* par '$Vchaine{SNB]' afin qu'il n'y ait plus de confusion entre les variables 'SETENV' */ $c /* et les variables (qui etaient de meme nom...) du '$c... */ $X echo "neutre" $X # commande destinee uniquement a mettre a jour l'environnement 'env'... # $Z setParam _____Regle_01 "$pN" $Z setParam _____Regle_02 "$pB" $Z setParam _____Regle_09 "$pN" $Z setParam _____Regle_10 "$pB" $Z if ($?_____Iterations == $NEXIST) then $Z EVAL _____IterationsX = $dimX / 2 $Z EVAL _____IterationsX = $_____IterationsX - $_____EKadre $Z EVAL _____IterationsX = $_____IterationsX - 1 $Z EVAL _____IterationsY = $dimY / 2 $Z EVAL _____IterationsY = $_____IterationsY - $_____EKadre $Z EVAL _____IterationsY = $_____IterationsY - 1 $Z $Z if ($_____IterationsX < $_____IterationsY) then $Z SET _____Iterations = $_____IterationsX $Z else $Z SET _____Iterations = $_____IterationsY $Z endif $Z else $Z endif $Z SET Premiere=0 $Z SET Derniere=63 $Z set Nhorizontale=`calcul sqrt($Derniere-$Premiere+1)` $Z set Nhorizontale=`echo $Nhorizontale | $SE -e "s/^[+-]//"` $Z set Nverticale=$Nhorizontale $Z EVAL _____TranslationX = $Xmax / 2 $Z EVAL AbScIsSe = $Xmax - $_____TranslationX $Z EVAL _____TranslationY = $Ymax / 2 $Z EVAL OrDoNnEe = $Ymax - $_____TranslationY $c extern char *getenv(); $c $c extern double log(); $c #define LOG2(x) (log((double)(x))/log(2.0)) $c $c #define N0 Premiere $c #define N Derniere $c $c #define NREGLES (LREGLES+1) $c #define LREGLES (3*3) $c #define dREGLES (NREGLES-LOG2(N-N0+1)-fREGLES) $c #define fREGLES 2 $c /* 'LREGLES' donne le nombre de points dans une regle, 'dREGLES' donne le nombre de points */ $c /* fixes au debut et 'fREGLES' donne le nombre de points fixes a la fin. */ $c $c int main() $c { $c char *chaineS=getenv("VchaineS"),caractereS; $c char *chaineN=getenv("VchaineN"),caractereN; $c char *chaineB=getenv("VchaineB"),caractereB; $c /* La modification du 20150612170520 a consiste a remplacer les variables '$chaine{SNB]' */ $c /* par '$Vchaine{SNB]' afin qu'il n'y ait plus de confusion entre les variables 'SETENV' */ $c /* et les variables (qui etaient de meme nom...) du '$c. Ainsi, avant cette date, la */ $c /* ligne precedente, soit : */ $c /* */ $c /* char *chaineS=getenv("chaineS"),caractereS; */ $c /* */ $c /* devenait via 'cpp' : */ $c /* */ $c /* char *pB=W=getenv("chaineS"),caractereS; */ $c /* */ $c /* ce qui particulierement mauvais... */ $c int n; $c $c caractereS = chaineS[0]; $c caractereN = chaineN[0]; $c caractereB = chaineB[0]; $c $c for (n=N0 ; n<=N ; n++) $c { $c int puissance=1; $c int IndexRegle; $c $c printf("$xci/init$X $c niveau=$NOIR $c $formatI | $c $xci/S_point$X $c X=$AbScIsSe $c Y=$OrDoNnEe $c niveau=$BLANC $c R=$xTV/INITIALES $c $formatI\n" $c ); $c printf("$xci/AutoC_2DB.01$Z $c $_____FAutoCellB $c %c$pN$pN$pN$pN$pN$pN$pN$pN$pN$pS$_____Regle_01" $c ,'"' $c ); $c printf(" $pB$pN$pN$pN$pN$pN$pN$pN$pN$pS$_____Regle_02" $c ); $c /* Edition arbitraire des 'dREGLES' premieres regles. */ $c $c for (IndexRegle=dREGLES ; IndexRegle<(NREGLES-fREGLES) ; IndexRegle++) $c { $c char chaine[LREGLES+3]; $c int IndexPoint; $c $c for (IndexPoint=0 ; IndexPoint<LREGLES ; IndexPoint++) $c { $c if (IndexPoint<IndexRegle) $c { $c chaine[IndexPoint] = caractereB; $c } $c else $c { $c chaine[IndexPoint] = caractereN; $c } $c } $c $c chaine[IndexPoint+0] = caractereS; $c $c if ((n & puissance) == 0) $c { $c chaine[IndexPoint+1] = caractereB; $c } $c else $c { $c chaine[IndexPoint+1] = caractereN; $c } $c $c chaine[IndexPoint+2] = 0; $c $c printf(" %s" $c ,chaine $c ); $c /* Edition des 'NREGLES-(dREGLES+fREGLES)' regles generees qui sont donc au nombre de */ $c /* 'LOG2(N-N0+1)' ; cette valeur a ete choisie car elle est un carre parfait (64 = 8x8) */ $c /* ce qui permet de generer facilement une image de type "matrice d'images"... */ $c $c puissance = 2*puissance; $c } $c $c printf(" $pB$pB$pB$pB$pB$pB$pB$pB$pN$pS$_____Regle_09" $c ); $c printf(" $pB$pB$pB$pB$pB$pB$pB$pB$pB$pS$_____Regle_10%c $_____EdAutoCellB\n" $c ,'"' $c ); $c /* Edition arbitraire des 'fREGLES' dernieres regles. */ $c $c printf("$xci/AutoC_2DQ.01$X $c A=$xTV/INITIALES $c automate=$_____FAutoCellB $c regles=%d $c longueur=%d $c iterations=$_____Iterations $c nombre_de_points=VRAI $c R=$xTV/AUTOMATE.%04d $c $formatI\n" $c ,NREGLES $c ,LREGLES $c ,n $c ); $c printf("$xci/cadre$X $c A=$xTV/AUTOMATE.%04d $c niveau=$_____CKadre $c epaisseur=$_____EKadre $c R=$xTV/KAUTOMATE.%04d $c $formatI\n" $c ,n,n $c ); $c printf("$DELETE $_____FAutoCellB\n"); $c } $c } $Z $xci/regroupe.01$Z $xTV/KAUTOMATE. \ $Z $_____ImageR \ $Z $Premiere \ $Z 1 \ $Z $Nhorizontale $Nverticale \ $Z "$K_VIDE" \ $Z "$formatR_Sdu" $Z # Le '$formatR_Sdu' a ete introduit le 20030121135300. #