sudokuprincipal.pm untested

filter: Statementstmt 0.0% 0 / 538 Branchbran 0.0% 0 / 180 Conditioncond 0.0% 0 / 33 MC/DCmcdc 0.0% 0 / 20 Subroutinesub 0.0% 0 / 25 Podpod 0.0% 0 / 22 totaltotal 0.0% 0 / 818 CC 91 SCAR 63.5
CC
91
Cov
0%
calminmax
1406.0
modif_tableau
552.0
cherche_seul
72.0
CRAP 575.0
1 #* Copyright (C) 2008 Christian Guine
2 # * This program is free software; you can redistribute it and/or modify it
3 # * under the terms of the GNU General Public License as published by the Free
4 # * Software Fondation; either version 2 of the License, or (at your option)
5 # * any later version.
6 # * This program is distributed in the hope that it will be useful, but WITHOUT
7 # * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 # * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
9 # * more details.
10 # * You should have received a copy of the GNU General Public License along with
11 # * this program; if not, write to the Free Software Foundation, Inc., 59
12 # * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
13 # */
14 # sudokuprincipal.pm
15 # to resolve Sudoku in few seconds
16 sub sudokuprincipal {
17  
18 }
19 1;
20  
21 sub traitement { # treatment of seizure
22 solution();
23 exportation();
24 verif_seul(); # we indicate if a number remains alone after calculation
25 $final = 0;
26 while ($final == 0) {
27 cherche_seul(); # we seek if a number can be alone in line column or area
28 }
29 $final = 0;
30 while ($final == 0) {
31 cherche_sequence(); # we seek if a number is surely that which misses
32 } # in its line column or area
33 verif_fin(); # we check if all is found
34 print $trait . "\n";
35  
36 affichage_grille('F');
37 }
38  
39 sub fin_saisie {
40 $traitexport = " ";
41 exportation();
42 $trait = "N";
43 solution();
44 $traitexport = "S";
45 exportation();
46 $trait = "V";
47 $fin = 0;
48 $traitexport = " ";
49 importation("","txt");
50 saisie1();
51 }
52  
53 sub saisie2 {
54 #print "saisie2 trait= " . $trait . "\n";
55 $erreur_saisie = 0;
56 if ($trait eq "V") {
57 fin_saisie();
58 } elsif ($trait eq "N") {
59 print ("Reprise saisie2\n");
60 } else {
61 saisie1();
62 }
63 }
64  
65 sub verif {
66 verif_fin(); # we verifie if all is found
67 if ($fin != 1) {
68 importation("","txt");
69 affichage_grille('T');
70 } else {
71 affichage_grille('F');
72 }
73 }
74  
75 sub solutiond {
76 $trait = "S";
77 solution();
78 }
79  
80 sub solution { # Posting solution
81 #$topcase = 30; #debug
82 #cherche_case_blanche1(); #debug
83 if ($trait eq "V") {
84 importation('W','txt'); # backup of initial grid
85 }
86 if ($trait eq "S") {
87 importation('S','txt');
88 }
89 #$topcase = 31; #debug
90 #cherche_case_blanche1(); #debug
91 verif_seul(); # we indicate if a number is alone
92 $final = 0;
93 #$topcase = 32; #debug
94 #cherche_case_blanche1(); #debug
95 while ($final == 0) {
96 cherche_seul(); # we check if a number can be alone in a line column or area
97 }
98 #$topcase = 33; #debug
99 #cherche_case_blanche1(); #debug
100 $final = 0;
101 while ($final == 0) {
102 cherche_sequence(); # we seek if a number is surely that which misses
103 # in its line column or area
104 }
105 #$topcase = 34; #debug
106 #cherche_case_blanche1(); #debug
107 verif_fin(); # we verify that all is found
108 if ($trait ne "N") {
109 affichage_grille('F');
110 }
111 }
112  
113 sub verif_fin #Checking that all is found
114 {
115 $fin = 1;
116 for ($i = 0; $i < $nbcase; $i++) {
117 for ($j = 0; $j < $nbcase; $j++) {
118 for ($k = 0; $k < $nbcase; $k++) {
119 if ($precarre[$i][$j][$k] eq "P") {
120 $fin = 0;
121 }
122 }
123 }
124 }
125 }
126  
127 sub cherche_sequence # we seek if a number is surely that which misses
128 # in its line column or area
129 {
130 # not implemented not useless
131 #print "cherche_sequence\n";
132 $final = 1;
133  
134 }
135  
136 sub cherche_seul
137 {
138 #print "cherche_seul\n";
139 $final = 1;
140 for ($csi = 0; $csi < $nbcase; $csi++) {
141 for ($csj = 0; $csj < $nbcase; $csj++) {
142 for ($csk = 0; $csk < $nbcase; $csk++) {
143 if ($precarre[$csi][$csj][$csk] eq "P") { # we find a number
144 # we check that it is not the only possible one in the line
145 # column or area
146 # checking on the column
147 $trouve = 0;
148 for ($wcsj = 0; $wcsj < $nbcase; $wcsj++) {
149 if ($precarre[$csi][$wcsj][$csk] eq "P") {
150 $trouve++;
151 }
152 }
153 if ($trouve == 1) {
154 $ligne = $csi;
155 $colonne = $csj;
156 $valeur = $csk;
157 $entree = "C";
158 $endroit = "colonne";
159 #$topcase = 2; # debug
160 modif_tableau();
161 #cherche_case_blanche1(); #debug
162 $final = 0;
163 }
164 # checking line
165 $trouve = 0;
166 for ($wcsi = 0; $wcsi < $nbcase; $wcsi++) {
167 if ($precarre[$wcsi][$csj][$csk] eq "P") {
168 $trouve++;
169 }
170 }
171 if ($trouve == 1) {
172 $ligne = $csi;
173 $colonne = $csj;
174 $valeur = $csk;
175 $entree = "C";
176 $endroit = "ligne";
177 #$topcase = 21;
178 modif_tableau();
179 #cherche_case_blanche1(); #debug
180 $final = 0;
181 }
182 # checking area
183 $trouve = 0;
184 ($wimin, $wimax, $wjmin, $wjmax) =
185 calminmax ($nbcase, $csi, $csj);
186 for ($wcsi = $wimin; $wcsi < $wimax; $wcsi++) {
187 for ($wcsj = $wjmin; $wcsj < $wjmax; $wcsj++) {
188 if ($precarre[$wcsi][$wcsj][$csk] eq "P") {
189 $trouve++;
190 }
191 }
192 }
193 if ($trouve == 1) {
194 $ligne = $csi;
195 $colonne = $csj;
196 $valeur = $csk;
197 $entree = "C";
198 $endroit = "carre";
199 #$topcase = 22;
200 modif_tableau();
201 #cherche_case_blanche1(); #debug
202 $final = 0;
203 }
204 }
205 }
206 }
207 }
208 }
209  
210 sub verif_seul # we verify that the number found is the only one in the square
211 {
212 #print "verif_seul\n";
213 for ($vsi = 0; $vsi < $nbcase; $vsi++) {
214 for ($vsj = 0; $vsj < $nbcase; $vsj++) {
215 $seul = 0;
216 for ($vsk = 0; $vsk < $nbcase; $vsk++) {
217 if ($precarre[$vsi][$vsj][$vsk] eq "P") {
218 $seul++;
219 }
220 }
221 if ($seul == 1) {
222 for ($vsk = 0; $vsk < $nbcase; $vsk++) {
223 if ($precarre[$vsi][$vsj][$vsk] eq "P") {
224 $ligne = $vsi;
225 $colonne = $vsj;
226 $valeur = $vsk;
227 $entree = "C";
228 $endroit = "";
229 #$topcase = 23;
230 modif_tableau();
231 #cherche_case_blanche1(); #debug
232 $final = 0;
233 }
234 }
235 }
236 }
237 }
238 }
239  
240 sub modif_tableau # If a number is found we cancel the possibility
241 # of this number on the same line, the same column
242 # and the same area
243 {
244 #print "modif_tableau " . $entree . " endroit " . $endroit . " ligne " . ($ligne + 1)
245 # . " colonne " . ($colonne + 1) . " valeur " . ($valeur + 1) . "\n";
246 if ($entree ne "P") {
247 $precarre[$ligne][$colonne][$valeur] = $entree; # S pour seizure C for calculated
248 }
249 for ($wwi = 0; $wwi < $nbcase; $wwi++) { # delete line
250 if ($entree ne "P") {
251 if ($precarre[$wwi][$colonne][$valeur] eq "P") {
252 $precarre[$wwi][$colonne][$valeur] = " ";
253 }
254 } else { # entree P we backup
255 if ($precarre[$wwi][$colonne][$valeur] eq " ") {
256 $trouve = 0;
257 for (my $wwk1 = 0; $wwk1 < $nbcase; $wwk1++) {
258 if ($precarre[$wwi][$colonne][$wwk1] eq "S"
259 or $precarre[$wwi][$colonne][$wwk1] eq "C") {
260 $trouve = 1;
261 }
262 }
263 if ($trouve == 0) {
264 $precarre[$wwi][$colonne][$valeur] = "P";
265 }
266 }
267 }
268 }
269 for ($wwj = 0; $wwj < $nbcase; $wwj++) { # delete column
270 if ($entree ne "P") {
271 if ($precarre[$ligne][$wwj][$valeur] eq "P") {
272 $precarre[$ligne][$wwj][$valeur] = " ";
273 }
274 } else { # entree P we backup
275 if ($precarre[$ligne][$wwj][$valeur] eq " ") {
276 $trouve = 0;
277 for (my $wwk1 = 0; $wwk1 < $nbcase; $wwk1++) {
278 if ($precarre[$ligne][$wwj][$wwk1] eq "S"
279 or $precarre[$ligne][$wwj][$wwk1] eq "C") {
280 $trouve = 1;
281 }
282 }
283 if ($trouve == 0) {
284 $precarre[$ligne][$wwj][$valeur] = "P";
285 }
286 }
287 }
288 }
289 for ($wwk = 0; $wwk < $nbcase; $wwk++) { # delete area
290 if ($entree ne "P") {
291 if ($precarre[$ligne][$colonne][$wwk] eq "P") {
292 $precarre[$ligne][$colonne][$wwk] = " ";
293 }
294 } else { # entree P we backup
295 if ($precarre[$ligne][$colonne][$wwk] eq " ") {
296 $trouve = 0;
297 for (my $wwk1 = 0; $wwk1 < $nbcase; $wwk1++) {
298 if ($precarre[$ligne][$colonne][$wwk1] eq "S"
299 or $precarre[$ligne][$colonne][$wwk1] eq "C") {
300 $trouve = 1;
301 }
302 }
303 if ($trouve == 0) {
304 $precarre[$ligne][$colonne][$wwk] = "P";
305 }
306 }
307 }
308 }
309 # delete possibility on an area
310 ($wimin, $wimax, $wjmin, $wjmax) = calminmax ($nbcase, $ligne, $colonne);
311 for ($wwi = $wimin; $wwi < $wimax; $wwi++) {
312 for ($wwj = $wjmin; $wwj < $wjmax; $wwj++) {
313 if ($entree ne "P") {
314 if ($precarre[$wwi][$wwj][$valeur] eq "P") {
315 $precarre[$wwi][$wwj][$valeur] = " ";
316 }
317 } else { # entree P we backup
318 if ($precarre[$wwi][$wwj][$valeur] eq " ") {
319 $trouve = 0;
320 for (my $wwk1 = 0; $wwk1 < $nbcase; $wwk1++) {
321 if ($precarre[$wwi][$wwj][$wwk1] eq "S"
322 or $precarre[$wwi][$wwj][$wwk1] eq "C") {
323 $trouve = 1;
324 }
325 }
326 if ($trouve == 0) {
327 $precarre[$wwi][$wwj][$valeur] = "P";
328 }
329 }
330 }
331 }
332 }
333 if ($entree eq "P") {
334 $precarre[$ligne][$colonne][$valeur] = $entree; # S pour seizure
335 # C for calculated
336 }
337 #cherche_case_blanche1(); #debug
338 }
339  
340 sub importations
341 {
342 use IO::File;
343 $filehandle = new IO::File;
344 my $retour = $filehandle->open("< sudokus$nbcase.txt")
345 or die "impossible ouvrir sudokus importations";
346 $#precarres = -1;
347 for (my $i = 0; $i < $nbcase; $i++) {
348 for (my $j = 0; $j < $nbcase; $j++) {
349 for (my $k = 0; $k < $nbcase; $k++) {
350 $filehandle->read($newtext,1);
351 $precarres[$i][$j][$k] = $newtext;
352 }
353 }
354 }
355 $filehandle->close;
356 }
357  
358 sub importation #importation data from a file
359 {
360 use IO::File;
361 #use File::Copy;
362 $#precarre = -1;
363 my ($traitexport, $extension) = @_;
364 if ($extension =~ m/sav/) {
365 $pref1 = $pref . "/sav/";
366 } else {
367 $pref1 = "";
368 }
369 #print "importation " . $traitexport . " extension " . $extension . "\n";
370 $filehandle = new IO::File;
371 my $fic = $pref1 . "sudoku" . $nbcase . "." . $extension;
372 my $fics = $pref1 . "sudokus" . $nbcase . "." . $extension;
373 if ($traitexport eq "S") {
374 my $retour = $filehandle->open("< $fics")
375 or die "impossible ouvrir sudokus$nbcase";
376 } else {
377 my $retour = $filehandle->open("< $fic");
378 print "fic $fic retour $retour\n";
379 if ($retour != 1) {
380 $filesortie = new IO::File;
381 $filesortie->open("> $fic")
382 or die "impossible ouvrir sortie $fic";
383 $filesortie->write(" ", 1);
384 $filesortie->close;
385 }
386 $filehandle->close;
387 $filehandle->open("< $fic")
388 or die "impossible d'ouvrir fichier";
389 }
390 print "restauration eff\n";
391 $#precarre = -1;
392 for ($i = 0; $i < $nbcase; $i++) {
393 for ($j = 0; $j < $nbcase; $j++) {
394 for ($k = 0; $k < $nbcase; $k++) {
395 $filehandle->read($newtext,1);
396 $precarre[$i][$j][$k] = $newtext;
397 }
398 }
399 }
400 $filehandle->close;
401 }
402  
403 sub sauve
404 {
405 $traitexport = " ";
406 exportation();
407 }
408  
409 sub exportation {
410 use IO::File;
411 #print "exportation trait " . $traitexport . " cpt1= " . $cpt1 . "\n";
412 $filesortie = new IO::File;
413 if ($traitexport eq "S") {
414 $filesortie->open("> sudokus$nbcase.txt")
415 or die "impossible ouvrir sortie sudokus$nbcase";
416 } else {
417 $filesortie->open("> sudoku$nbcase.txt") or die "impossible ouvrir sortie ";
418 }
419 $cpt2 = 0;
420 for ($i = 0; $i < $nbcase; $i++) {
421 for ($j = 0; $j < $nbcase; $j++) {
422 for ($k = 0; $k < $nbcase; $k++) {
423 $text = $precarre[$i][$j][$k];
424 $filesortie->write($text, 1);
425 }
426 }
427 }
428 $filesortie->close;
429 }
430  
431 sub init_tableau {
432 # initialization table
433 for ($i = 0; $i < $nbcase; $i++) { # init lines
434 for ($j = 0; $j < $nbcase; $j++) { # init columns
435 for ($k = 0; $k < $nbcase; $k++) { # init areas
436 $precarre[$i][$j][$k] = "P"; # P for possible
437 }
438 }
439 }
440 }
441
442 sub retour_arriere {
443 print "backup $difficulte\n";
444 my $cpt = 0;
445 my $cpt1 = 0;
446 #edit();
447 while ($cpt < $difficulte and $cpt1 < 100) {
448 $cpt1++;
449 my $is = int(rand($nbcase));
450 my $js = int(rand($nbcase));
451 my $ks = int(rand($nbcase));
452 if ($precarre[$is][$js][$ks] eq "C" or
453 $precarre[$is][$js][$ks] eq "S") {
454 #print "retour arriere $is $js $ks\n";
455 $ligne = $is;
456 $colonne = $js;
457 $valeur = $ks;
458 $entree = "P";
459 $endroit = "";
460 modif_tableau();
461 #edit();
462 $cpt++;
463 }
464  
465 }
466 }
467  
468 sub cherche_case_blanche {
469 # it is checked that there is no completely cancelled square
470 for ($wic = 0; $wic < $nbcase; $wic++) {
471 for ($wjc = 0; $wjc < $nbcase; $wjc++) {
472 $trouvec = 0;
473 for ($wkc = 0; $wkc < $nbcase; $wkc++) {
474 if ($precarre[$wic][$wjc][$wkc] ne " ") {
475 $trouvec = 1;
476 }
477 }
478 if ($trouvec == 0 and $topcase != 0) { #debug supprimer
479 print ("\ncase blanche ic " . $wic . " jc " . $wjc . " topcase" . $topcase
480 #. " vsi " . $vsi . " vsj " . $vsj .
481 #" vsk " . $vsk . " csi " . $csi . " csj " . $csj .
482 #" csk " . $csk . "cptcase" . $cptcaseblanche . " cpt " . $cpt
483 #. " cpt1 " . $cpt1 . "\n");
484 . " ");
485 #edit();
486 #exit;
487 $caseblanche = 1;
488 $cptcaseblanche++;
489 if ($cptcaseblanche > 3000) {
490 $force = 1;
491 }
492 $topcase = 0;
493 }
494 }
495 }
496 }
497  
498 sub edit {
499 my $edit;
500 for (my $wid = 0; $wid < $nbcase; $wid++) {
501 for (my $wjd = 0; $wjd < $nbcase; $wjd++) {
502 print ("|" . $wid . "." . $wjd . ".");
503 for (my $wkd = 0; $wkd < $nbcase; $wkd++) {
504 #if ($precarre [$wid][$wjd][$wkd] ne $wprecarre [$wid][$wjd][$wkd]) {
505 $edit = $precarre [$wid][$wjd][$wkd];
506 if ($edit eq " ") {
507 $edit = "_";
508 }
509 print ($edit);
510 # print ($wprecarre [$wid][$wjd][$wkd] . "|");
511 #}
512 }
513 }
514 print "\n";
515 }
516 }
517  
518 sub calminmax {
519 my ($nbcase, $ligne, $colonne, $code) = @_;
520 my $wimax = 0;
521 my $wimin = 0;
522 my $wjmax = 0;
523 my $wjmin = 0;
524 if ($nbcase == 4) { # Enfant
525 if ($ligne < 2) {
526 $wimax = 2;
527 $wimin = 0;
528 } else {
529 $wimax = 4;
530 $wimin = 2;
531 }
532 if ($colonne < 2) {
533 $wjmax = 2;
534 $wjmin = 0;
535 } else {
536 $wjmax = 4;
537 $wjmin = 2;
538 }
539 }
540 if ($nbcase == 6) { # Simpliste
541 if ($ligne < 2) {
542 $wimax = 2;
543 $wimin = 0;
544 } elsif ($ligne < 4) {
545 $wimax = 4;
546 $wimin = 2;
547 } else {
548 $wimax = 6;
549 $wimin = 4;
550 }
551 if ($colonne < 3) {
552 $wjmax = 3;
553 $wjmin = 0;
554 } else {
555 $wjmax = 6;
556 $wjmin = 3;
557 }
558 }
559 if ($nbcase == 8) { # Ardu
560 if ($ligne < 2) {
561 $wimax = 2;
562 $wimin = 0;
563 } elsif ($ligne < 4) {
564 $wimax = 4;
565 $wimin = 2;
566 } elsif ($ligne < 6) {
567 $wimax = 6;
568 $wimin = 4;
569 } else {
570 $wimax = 8;
571 $wimin = 6;
572 }
573 if ($colonne < 4) {
574 $wjmax = 4;
575 $wjmin = 0;
576 } else {
577 $wjmax = 8;
578 $wjmin = 4;
579 }
580 }
581 if ($nbcase == 9) { # Normal
582 if ($ligne < 3) {
583 $wimax = 3;
584 $wimin = 0;
585 } elsif ($ligne < 6) {
586 $wimax = 6;
587 $wimin = 3;
588 } else {
589 $wimax = 9;
590 $wimin = 6;
591 }
592 if ($colonne < 3) {
593 $wjmax = 3;
594 $wjmin = 0;
595 } elsif ($colonne < 6) {
596 $wjmax = 6;
597 $wjmin = 3;
598 } else {
599 $wjmax = 9;
600 $wjmin = 6;
601 }
602 }
603 if ($nbcase == 10) { # Difficile
604 if ($ligne < 2) {
605 $wimax = 2;
606 $wimin = 0;
607 } elsif ($ligne < 4) {
608 $wimax = 4;
609 $wimin = 2;
610 } elsif ($ligne < 6) {
611 $wimax = 6;
612 $wimin = 4;
613 } elsif ($ligne < 8) {
614 $wimax = 8;
615 $wimin = 6;
616 } else {
617 $wimax = 10;
618 $wimin = 8;
619 }
620 if ($colonne < 5) {
621 $wjmax = 5;
622 $wjmin = 0;
623 } else {
624 $wjmax = 10;
625 $wjmin = 5;
626 }
627 }
628 if ($nbcase == 12) { # Tresdifficile
629 if ($ligne < 3) {
630 $wimax = 3;
631 $wimin = 0;
632 } elsif ($ligne < 6) {
633 $wimax = 6;
634 $wimin = 3;
635 } elsif ($ligne < 9) {
636 $wimax = 9;
637 $wimin = 6;
638 } else {
639 $wimax = 12;
640 $wimin = 9;
641 }
642 if ($colonne < 4) {
643 $wjmax = 4;
644 $wjmin = 0;
645 } elsif ($colonne < 8) {
646 $wjmax = 8;
647 $wjmin = 4;
648 } else {
649 $wjmax = 12;
650 $wjmin = 8;
651 }
652 }
653 if ($nbcase == 16) { # Maxi
654 if ($ligne < 4) {
655 $wimax = 4;
656 $wimin = 0;
657 } elsif ($ligne < 8) {
658 $wimax = 8;
659 $wimin = 4;
660 } elsif ($ligne < 12) {
661 $wimax = 12;
662 $wimin = 8;
663 } else {
664 $wimax = 16;
665 $wimin = 12;
666 }
667 if ($colonne < 4) {
668 $wjmax = 4;
669 $wjmin = 0;
670 } elsif ($colonne < 8) {
671 $wjmax = 8;
672 $wjmin = 4;
673 } elsif ($colonne < 12) {
674 $wjmax = 12;
675 $wjmin = 8;
676 } else {
677 $wjmax = 16;
678 $wjmin = 12;
679 }
680 }
681 return($wimin, $wimax, $wjmin, $wjmax);
682 }
683  
684 sub calminmaxred {
685 my ($nbcase, $code) = @_;
686 # Enfant -- -- Simpliste --- --- Ardu ---- ---- Normal --- --- --- Maxi ---- ---- ---- ----
687 # -- -- --- --- ---- ---- --- --- --- ---- ---- ---- ----
688 # --- --- --- ---- ---- ---- ----
689 # --- --- ---- ---- ---- ---- ---- ----
690 # --- --- ---- ---- --- --- ---
691 # --- --- --- ---- ---- ---- ----
692 # --- --- ---- ---- --- --- --- ---- ---- ---- ----
693 # --- --- ---- ---- ---- ---- ---- ----
694 # --- --- --- ---- ---- ---- ----
695 # ---- ---- --- --- ---
696 # ---- ---- --- --- --- ---- ---- ---- ----
697 # ---- ---- ---- ----
698 # ---- ---- ---- ----
699 # ---- ---- ---- ----
700 #
701 # ---- ---- ---- ----
702 # ---- ---- ---- ----
703 # ---- ---- ---- ----
704 # ---- ---- ---- ----
705 # Difficile ----- ----- Tresdifficile ---- ---- ----
706 # ----- ----- ---- ---- ----
707 # ---- ---- ----
708 # ----- -----
709 # ----- ----- ---- ---- ----
710 # ---- ---- ----
711 # ----- ----- ---- ---- ----
712 # ----- -----
713 # ---- ---- ----
714 # ----- ----- ---- ---- ----
715 # ----- ----- ---- ---- ----
716 #
717 # ----- ----- ---- ---- ----
718 # ----- ----- ---- ---- ----
719 # ---- ---- ----
720 my $wimax = 0;
721 my $wjmax = 0;
722 my $wimax1 = O;
723 my $wjmax1 = 0;
724 if ($nbcase == 4) { # Enfant
725 $wimax = 2; # number area vertical
726 $wjmax = 2; # number area horizontal
727 $wimax1 = 2; # number of vertical figures (lines) in an area
728 $wjmax1 = 2; # number of horizontal figures (columns) in an area
729 } elsif ($nbcase == 6) { # Simpliste
730 $wimax = 3;
731 $wjmax = 2;
732 $wimax1 = 2;
733 $wjmax1 = 3;
734 } elsif ($nbcase == 8) { # Ardu
735 $wimax = 4;
736 $wjmax = 2;
737 $wimax1 = 2;
738 $wjmax1 = 4;
739 } elsif ($nbcase == 10) { # Difficile
740 $wimax = 5;
741 $wjmax = 2;
742 $wimax1 = 2;
743 $wjmax1 = 5;
744 } elsif ($nbcase == 12) { # Maxi
745 $wimax = 4;
746 $wjmax = 3;
747 $wimax1 = 3;
748 $wjmax1 = 4;
749 } elsif ($nbcase == 16) { # Maxi
750 $wimax = 4;
751 $wjmax = 4;
752 $wimax1 = 4;
753 $wjmax1 = 4;
754 } else { # Normal
755 $wimax = 3;
756 $wjmax = 3;
757 $wimax1 = 3;
758 $wjmax1 = 3;
759 }
760 return ($wimax, $wjmax, $wimax1, $wjmax1);
761 }