définitions
This commit is contained in:
parent
b70b8cdc56
commit
1075f4e9e8
@ -9,9 +9,9 @@ const MAX_ESSAIS = 10000;
|
|||||||
|
|
||||||
class Grille {
|
class Grille {
|
||||||
public $grille;
|
public $grille;
|
||||||
|
public $hauteur;
|
||||||
|
public $largeur;
|
||||||
private $grilles;
|
private $grilles;
|
||||||
private $hauteur;
|
|
||||||
private $largeur;
|
|
||||||
private $mots_commencant_par;
|
private $mots_commencant_par;
|
||||||
private $mots_utilises = [];
|
private $mots_utilises = [];
|
||||||
|
|
||||||
|
3
dico.php
3
dico.php
@ -27,6 +27,7 @@ foreach ($mots_de_n_lettres as $n => $mots) {
|
|||||||
|
|
||||||
function mots_espaces($max, $min=0) {
|
function mots_espaces($max, $min=0) {
|
||||||
global $mots_de_n_lettres;
|
global $mots_de_n_lettres;
|
||||||
|
global $dico;
|
||||||
|
|
||||||
foreach($mots_de_n_lettres[$max] as $mot) {
|
foreach($mots_de_n_lettres[$max] as $mot) {
|
||||||
yield $mot;
|
yield $mot;
|
||||||
@ -35,7 +36,9 @@ function mots_espaces($max, $min=0) {
|
|||||||
foreach ($mots_de_n_lettres[$i] as $mot1) {
|
foreach ($mots_de_n_lettres[$i] as $mot1) {
|
||||||
foreach (mots_espaces($max - $i -1, $min) as $mot2) {
|
foreach (mots_espaces($max - $i -1, $min) as $mot2) {
|
||||||
if ($mot1 != $mot2) {
|
if ($mot1 != $mot2) {
|
||||||
|
$dico["$mot1 $mot2"] = $dico[$mot1] && $dico[$mot2] ? "{$dico[$mot1]}. {$dico[$mot2]}." : $dico[$mot1] . $dico[$mot2];
|
||||||
yield "$mot1 $mot2";
|
yield "$mot1 $mot2";
|
||||||
|
$dico["$mot2 $mot1"] = $dico[$mot2] && $dico[$mot1] ? "{$dico[$mot2]}. {$dico[$mot1]}." : $dico[$mot2] . $dico[$mot1];
|
||||||
yield "$mot2 $mot1";
|
yield "$mot2 $mot1";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
74
index.php
74
index.php
@ -6,8 +6,8 @@ ini_set('error_reporting', E_ALL);
|
|||||||
include_once "dico.php";
|
include_once "dico.php";
|
||||||
include_once "Grille.php";
|
include_once "Grille.php";
|
||||||
|
|
||||||
const HAUTEUR_PAR_DEFAUT = 3;
|
const HAUTEUR_PAR_DEFAUT = 5;
|
||||||
const LARGEUR_PAR_DEFAUT = 4;
|
const LARGEUR_PAR_DEFAUT = 5;
|
||||||
|
|
||||||
$hauteur = filter_input(INPUT_GET, 'lignes', FILTER_VALIDATE_INT, [
|
$hauteur = filter_input(INPUT_GET, 'lignes', FILTER_VALIDATE_INT, [
|
||||||
"options" => [
|
"options" => [
|
||||||
@ -33,43 +33,45 @@ $grille = new Grille($hauteur, $largeur);
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>Mots croisés</title>
|
<title>Mots croisés</title>
|
||||||
<style>
|
<link rel="stylesheet" href="style.css">
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
th, td {
|
|
||||||
width: 30px;
|
|
||||||
height: 30px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.case.noire {
|
|
||||||
background-color: black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<table class="grille">
|
<div class="grille">
|
||||||
<tr>
|
<table class="grille">
|
||||||
<th></th>
|
<tr>
|
||||||
<?php for ($c = 0; $c < $largeur; $c++): ?>
|
<th></th>
|
||||||
<th><?= chr($c + 65) ?></th>
|
<?php for ($c = 0; $c < $largeur; $c++): ?>
|
||||||
|
<th><?= chr($c + 65) ?></th>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</tr>
|
||||||
|
<?php for ($l = 0; $l < $hauteur; $l++): ?>
|
||||||
|
<tr>
|
||||||
|
<th><?= $l ?></th>
|
||||||
|
<?php for ($c = 0; $c < $largeur; $c++): ?>
|
||||||
|
<td class="case <?= $grille->grille[$l][$c]==" "?"noire": "blanche" ?>"><?= $grille->grille[$l][$c] ?></td>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</tr>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
</tr>
|
</table>
|
||||||
<?php for ($l = 0; $l < $hauteur; $l++): ?>
|
</div>
|
||||||
<tr>
|
<div class="definitions">
|
||||||
<th><?= $l ?></th>
|
<div class="horizontales">
|
||||||
<?php for ($c = 0; $c < $largeur; $c++): ?>
|
<h2>Horizontalement</h2>
|
||||||
<td class="case <?= $grille->grille[$l][$c]==" "?"noire": "blanche" ?>"><?= $grille->grille[$l][$c] ?></td>
|
<ol>
|
||||||
<?php endfor; ?>
|
<?php for ($l = 0; $l < $hauteur; $l++): ?>
|
||||||
</tr>
|
<li><?= $dico[$grille->get_ligne($l, $largeur)] ?></li>
|
||||||
<?php endfor; ?>
|
<?php endfor; ?>
|
||||||
</table>
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div class="verticales">
|
||||||
|
<h2>Verticalement</h2>
|
||||||
|
<ol type="A">
|
||||||
|
<?php for ($c = 0; $c < $largeur; $c++): ?>
|
||||||
|
<li><?= $dico[$grille->get_colonne($c, $hauteur)] ?></li>
|
||||||
|
<?php endfor; ?>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</html>
|
</html>
|
31
style.css
Normal file
31
style.css
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
body {
|
||||||
|
margin: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grille {
|
||||||
|
margin: 2rem auto;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
th, td {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.case.noire {
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.definitions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
}
|
||||||
|
|
||||||
|
.definitions h2 {
|
||||||
|
font-variant-caps: petite-caps;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user