[ "default" => HAUTEUR_DEFAUT, "min_range" => HAUTEUR_MIN, "max_range" => HAUTEUR_MAX ] ]); $largeur = filter_input(INPUT_GET, 'colonnes', FILTER_VALIDATE_INT, [ "options" => [ "default" => LARGEUR_DEFAUT, "min_range" => LARGEUR_MIN, "max_range" => LARGEUR_MAX ] ]); $grille = new Grille($hauteur, $largeur); if (!isset($_GET["grille"]) || $_GET["grille"] == "") { do { $id = uniqid(); } while (!$grille->genere($id)); $_GET["grille"] = $id; header("Location: " . dirname($_SERVER['DOCUMENT_URI']) . "?" . http_build_query($_GET)); exit; } $id = htmlspecialchars($_GET["grille"]); $grille_valide = $grille->load($id) || $grille->genere($id); mt_srand(crc32($id)); if ($grille_valide) { $definitions_horizontales = []; for ($y = 0; $y < $hauteur; $y++) { $definitions_horizontales[$y] = []; foreach ($grille->lignes[$y] as $mot) { $definitions = $grille->dico[strlen($mot)][$mot]; if (count($definitions)) { $definition = $definitions[mt_rand(0, count($definitions) - 1)]; if (strpos($definition, "#") !== false) { [$definition, $nb_mots] = explode("#", $definition); $definition .= " ($nb_mots mots)"; } if (strpos($definition, "@") !== false) { [$definition, $auteur] = explode("@", $definition); $definition .= " $auteur"; } $definitions_horizontales[$y][] = $definition; } } } $definitions_verticales = []; for ($x = 0 ; $x < $largeur; $x++) { $definitions_verticales[$x] = []; foreach ($grille->colonnes[$x] as $mot) { $definitions = $grille->dico[strlen($mot)][$mot]; if (count($definitions)) { $definition = $definitions[mt_rand(0, count($definitions) - 1)]; if (strpos($definition, "#") !== false) { [$definition, $nb_mots] = explode("#", $definition); $definition .= " ($nb_mots mots)"; } if (strpos($definition, "@") !== false) { [$definition, $auteur] = explode("@", $definition); $definition .= " $auteur"; } $definitions_verticales[$x][] = $definition; } } } } ?> MOTS■CROISES

M
c r o i s é s
t
s

Mots■croisés

" />

Horizontalement

    $definitions): ?>

Verticalement

    $definitions): ?>

Erreur de génération de la grille

de value="" min="" max=""/> lignes et value="" min="" max=""/> colonnes