définitions
This commit is contained in:
parent
b70b8cdc56
commit
1075f4e9e8
@ -9,9 +9,9 @@ const MAX_ESSAIS = 10000;
|
||||
|
||||
class Grille {
|
||||
public $grille;
|
||||
public $hauteur;
|
||||
public $largeur;
|
||||
private $grilles;
|
||||
private $hauteur;
|
||||
private $largeur;
|
||||
private $mots_commencant_par;
|
||||
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) {
|
||||
global $mots_de_n_lettres;
|
||||
global $dico;
|
||||
|
||||
foreach($mots_de_n_lettres[$max] as $mot) {
|
||||
yield $mot;
|
||||
@ -35,7 +36,9 @@ function mots_espaces($max, $min=0) {
|
||||
foreach ($mots_de_n_lettres[$i] as $mot1) {
|
||||
foreach (mots_espaces($max - $i -1, $min) as $mot2) {
|
||||
if ($mot1 != $mot2) {
|
||||
$dico["$mot1 $mot2"] = $dico[$mot1] && $dico[$mot2] ? "{$dico[$mot1]}. {$dico[$mot2]}." : $dico[$mot1] . $dico[$mot2];
|
||||
yield "$mot1 $mot2";
|
||||
$dico["$mot2 $mot1"] = $dico[$mot2] && $dico[$mot1] ? "{$dico[$mot2]}. {$dico[$mot1]}." : $dico[$mot2] . $dico[$mot1];
|
||||
yield "$mot2 $mot1";
|
||||
}
|
||||
}
|
||||
|
44
index.php
44
index.php
@ -6,8 +6,8 @@ ini_set('error_reporting', E_ALL);
|
||||
include_once "dico.php";
|
||||
include_once "Grille.php";
|
||||
|
||||
const HAUTEUR_PAR_DEFAUT = 3;
|
||||
const LARGEUR_PAR_DEFAUT = 4;
|
||||
const HAUTEUR_PAR_DEFAUT = 5;
|
||||
const LARGEUR_PAR_DEFAUT = 5;
|
||||
|
||||
$hauteur = filter_input(INPUT_GET, 'lignes', FILTER_VALIDATE_INT, [
|
||||
"options" => [
|
||||
@ -33,28 +33,11 @@ $grille = new Grille($hauteur, $largeur);
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mots croisés</title>
|
||||
<style>
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th, td {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
td {
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.case.noire {
|
||||
background-color: black;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="grille">
|
||||
<table class="grille">
|
||||
<tr>
|
||||
<th></th>
|
||||
@ -71,5 +54,24 @@ $grille = new Grille($hauteur, $largeur);
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="definitions">
|
||||
<div class="horizontales">
|
||||
<h2>Horizontalement</h2>
|
||||
<ol>
|
||||
<?php for ($l = 0; $l < $hauteur; $l++): ?>
|
||||
<li><?= $dico[$grille->get_ligne($l, $largeur)] ?></li>
|
||||
<?php endfor; ?>
|
||||
</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>
|
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