interface trie avec des strings

This commit is contained in:
2025-05-07 21:21:48 +02:00
parent d5a120cd9a
commit ddebd453df
4 changed files with 40 additions and 21 deletions

View File

@ -1,5 +1,4 @@
<?php
include_once "dico.php";
include_once "Grille.php";
@ -49,7 +48,7 @@ if ($grille_valide) {
for ($y = 0; $y < $hauteur; $y++) {
$definitions_horizontales[$y] = [];
foreach ($grille->lignes[$y] as $mot) {
$definitions = $grille->dico[strlen($mot)][str_split($mot)];
$definitions = $grille->dico[strlen($mot)][$mot];
if (count($definitions)) {
$definitions_horizontales[$y][] = $definitions[mt_rand(0, count($definitions) - 1)];
}
@ -59,7 +58,7 @@ if ($grille_valide) {
for ($x = 0 ; $x < $largeur; $x++) {
$definitions_verticales[$x] = [];
foreach ($grille->colonnes[$x] as $mot) {
$definitions = $grille->dico[strlen($mot)][str_split($mot)];
$definitions = $grille->dico[strlen($mot)][$mot];
if (count($definitions)) {
$definitions_verticales[$x][] = $definitions[mt_rand(0, count($definitions) - 1)];
}