0) if (openpos($x-1,$y,constant("bas"),&$tableau)) $i += constant("haut"); if ($x < constant("dimx")-1) if (openpos($x+1,$y,constant("haut"),&$tableau)) $i += constant("bas"); if ($y > 0) if (openpos($x,$y-1,constant("droite"),&$tableau)) $i += constant("gauche"); if ($y < constant("dimy")-1) if (openpos($x,$y+1,constant("gauche"),&$tableau)) $i += constant("droite"); return $i; } function nbrpos($pos) { $i = 0; if (($pos&constant("gauche")) == constant("gauche")) $i++; if (($pos&constant("haut")) == constant("haut")) $i++; if (($pos&constant("droite")) == constant("droite")) $i++; if (($pos&constant("bas")) == constant("bas")) $i++; return $i; } function set($x,$y,$val,&$tableau) { $tableau[$x*constant("dimy")+$y] = $val; } function get($x,$y,&$tableau) { return $tableau[$x*constant("dimy")+$y]; } function init($val) { $x = 0; while ($x < constant("dimx")) { $y = 0; while ($y $ancdir) set($x,$y,get($x,$y,&$tabimg).strval($ancdir).strval($dir),&$tabimg); else set($x,$y,get($x,$y,&$tabimg).strval($dir).strval($ancdir),&$tabimg); if ($dir == invdir($ancdir)) set($x,$y,get($x,$y,&$tabdata)+$dir+$ancdir,&$tabdata); else set($x,$y,constant("gauche")+constant("haut")+constant("droite")+constant("bas"),&$tabdata); $x = nextx($x,$dir); $y = nexty($y,$dir); $i++; } set($x,$y,get($x,$y,&$tabimg).strval(invdir($dir)),&$tabimg); return $i; } $tabd = init(0); $tabi = init(''); $nbr = construit(&$tabd,&$tabi); if (isset($_GET["set"])) $set = $_GET["set"]; else $set = "set2"; echo ""; $x = 0; while ($x < constant("dimx")) { echo ""; $y = 0; while ($y \"",$tabi[$x*constant("dimy")+$y],"\""; $y++; } echo ""; $x++; } echo "
"; $rep = opendir('./img/'); while ($file = readdir($rep)) { if (($file != '.') and ($file != '..')) echo '',$file,' '; } closedir($rep); ?>