renommage
This commit is contained in:
parent
cb4c6c91ed
commit
5537607011
26
Grille.php
26
Grille.php
@ -25,15 +25,15 @@ class Grille {
|
||||
$dimensions = [$hauteur, $largeur];
|
||||
}
|
||||
$this->mots_commencant_par = [];
|
||||
foreach ($dimensions as $dimension) {
|
||||
$this->mots_commencant_par[$dimension] = [];
|
||||
foreach(mots_espaces($dimension, MIN_LETTRES) as $mot) {
|
||||
for ($i = 0; $i <= $dimension; $i++) {
|
||||
foreach ($dimensions as $longueur) {
|
||||
$this->mots_commencant_par[$longueur] = [];
|
||||
foreach(mots_espaces($longueur, MIN_LETTRES) as $mot) {
|
||||
for ($i = 0; $i <= $longueur; $i++) {
|
||||
$debut = substr($mot, 0, $i);
|
||||
if (!isset($this->mots_commencant_par[$dimension][$debut])) {
|
||||
$this->mots_commencant_par[$dimension][$debut] = [];
|
||||
if (!isset($this->mots_commencant_par[$longueur][$debut])) {
|
||||
$this->mots_commencant_par[$longueur][$debut] = [];
|
||||
}
|
||||
$this->mots_commencant_par[$dimension][$debut][] = $mot;
|
||||
$this->mots_commencant_par[$longueur][$debut][] = $mot;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,10 +41,10 @@ class Grille {
|
||||
$this->grilles->current();
|
||||
}
|
||||
|
||||
public function get_ligne($l, $max = 100) {
|
||||
public function get_ligne($l, $longueur = 100) {
|
||||
$longueur = min($longueur, $this->largeur);
|
||||
$ligne = "";
|
||||
$min = min($this->largeur, $max);
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
for ($i = 0; $i < $longueur; $i++) {
|
||||
$ligne .= $this->grille[$l][$i];
|
||||
}
|
||||
return $ligne;
|
||||
@ -56,10 +56,10 @@ class Grille {
|
||||
}
|
||||
}
|
||||
|
||||
public function get_colonne($c, $max = 100) {
|
||||
public function get_colonne($c, $longueur = 100) {
|
||||
$longueur = min($longueur, $this->hauteur);
|
||||
$colonne = "";
|
||||
$min = min($this->hauteur, $max);
|
||||
for ($i = 0; $i < $min; $i++) {
|
||||
for ($i = 0; $i < $longueur; $i++) {
|
||||
$colonne .= $this->grille[$i][$c];
|
||||
}
|
||||
return $colonne;
|
||||
|
@ -51,7 +51,7 @@ $grille = new Grille($hauteur, $largeur);
|
||||
<?php for ($c = 0; $c < $largeur; $c++): ?>
|
||||
<td class="case <?= $grille->grille[$l][$c]==" "?"noire": "blanche" ?>">
|
||||
<?php if ($grille->grille[$l][$c] == " "): ?>
|
||||
<input type="text" maxlength="1" size="1" name="<?= $l . $c ?>" disabled/>
|
||||
<input type="text" maxlength="1" size="1" name="<?= $l . $c ?>" value=" " disabled/>
|
||||
<?php else: ?>
|
||||
<input type="text" maxlength="1" size="1" name="<?= $l . $c ?>" />
|
||||
<?php endif; ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user