Exemple #1
0
 public function __construct($formateur)
 {
     parent::__construct($formateur);
     //question 1
     $qtype1 = array('Les hommes ont commencé à compter ...', 'Les hommes ont commencé à compter ...', 'Le mot calculus ...', 'Le mot zéro ...');
     $rtype1 = array(array(array('Sur leurs doigts' => false), array('Avec des cailloux et des bâtons' => true), array('En utilisant la numération décimale' => false), array('Avec une calculatrice' => false)), array(array('Il y a plus de 100 000 ans' => false), array('Lorsqu\'ils ont commencé à savoir écrire' => false), array('Il y a environ 30 000 ans' => true), array('Il y a environ 20 000 ans' => false)), array(array('Est un mot d\'origine grèque' => false), array('Est un mot d\'origine chinoise' => false), array('Signifie bâton' => false), array('Signifie cailloux' => true)), array(array('Vient de l\'arabe sifr' => true), array('Vient du chinoix sifo' => false), array('Vient du grec zefo' => false), array('Vient du latin zefus' => false)));
     $alea1 = rand(0, 3);
     //Question 2
     $qtype2 = array('La numération décimale est ', 'La numération Maya est', 'En informatique, on utilise', 'En informatique, on utilise', 'La numération romaine');
     $rtype2 = array(array(array('Un système additif' => false), array('Une numération de position' => true), array('Utilise 10 chiffres' => true), array('Utilisée actuellement' => true)), array(array('Un système additif' => false), array('Une numération de position' => true), array('Utilise 19 chiffres' => true), array('Vieille de 1 400 ans environs' => true)), array(array('Une numération à 4 chiffres' => false), array('Une numération de position' => true), array('La numération binaire' => true), array('Une numération à 2 chiffres' => true)), array(array('Est inspirée de la numération chinoise' => false), array('Est encore utilisée aujourd\'hui dans certains cas' => true), array('Est parfois utilisée en informatique' => true), array('Est un système additif' => true)));
     $alea2 = rand(0, 4);
     //Question 3
     $nbrom = array('I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX', 'XXI', 'XXII', 'XXIII', 'XXIV', 'XXV', 'XXVI', 'XXVII', 'XXVIII', 'XXIX', 'XXX');
     $nbromfaux = array('X', 'V', 'E', 'IIII', 'IIIII', 'L', '7', 'IIX', 'VIIII', 'V', 'VI', '12', '13', 'XIIII', 'VX', 'XIIIIII', 'LII', 'LIII', 'XVIIII', 'C', 'CI', 'CII', 'CIII', 'XXIIII', 'VVX', 'MI', 'MII', 'XVIII', 'XXVIIII', 'IIIX');
     $alea3 = rand(1, 28);
     $qtype3 = 'En chiffres romains, ' . ($alea3 + 1) . ' s\'écrit ...';
     $rtype3 = array(array($nbrom[$alea3] => true), array($nbrom[$alea3 - 1] => false), array($nbrom[$alea3 + 1] => false), array($nbromfaux[$alea3] => false));
     //Mise en commun
     $this->questions = array($qtype1[$alea1], $qtype2[$alea2], $qtype3);
     $this->reponses = array($rtype1[$alea1], $rtype2[$alea2], $rtype3);
     foreach ($this->reponses as $cle => $val) {
         shuffle($this->reponses[$cle]);
     }
 }
Exemple #2
0
 public function __construct($formateur)
 {
     parent::__construct($formateur);
     //Question 1
     $qtype1 = array('Dix-huit millions huit cent douze s\'écrit en chiffres ... ', 'Vingt-trois millions deux mille douze s\'écrit en chiffres ... ', 'Sept cent milliards trois cents s\'écrit en chiffres ... ', 'Cinq millions deux cent cinquante mille vingt s\'écrit en chiffres ... ', 'Soixante dix milliards vingt huit s\'écrit en chiffres ... ', 'Cinquante deux millions deux cent trois mille neuf s\'écrit en chiffres ... ', 'Deux cent quarante mille cinq s\'écrit en chiffres ... ', 'Douze millions cent trois s\'écrit en chiffres ... ', 'Quarante milliards trois millions six cents s\'écrit en chiffres ... ', 'Vingt milliards soixante millions vingt huit s\'écrit en chiffres ... ');
     $rtype1 = array(array(array('18 812 000' => false), array('18 800 012' => false), array('18 800 120' => false), array('18 000 812' => true)), array(array('23 012 000' => false), array('23 120 000' => false), array('23 012 00' => false), array('23 002 012' => true)), array(array('700 000 300 000' => false), array('700 000 003 000' => false), array('700 000 030 000' => false), array('700 000 000 300' => true)), array(array('5 250 200' => false), array('5 020 250' => false), array('5 200 250' => false), array('5 250 020' => true)), array(array('70 000 000 280' => false), array('70 000 280 000' => false), array('70 000 028 000' => false), array('70 000 000 028' => true)), array(array('52 812 900' => false), array('52 203 090' => false), array('52 239 000' => false), array('52 203 009' => true)), array(array('240 500' => false), array('240 050' => false), array('245 000' => false), array('240 005' => true)), array(array('12 100 300' => false), array('12 100 003' => false), array('12 103 000' => false), array('12 000 103' => true)), array(array('40 300 600 000' => false), array('40 003 600 000' => false), array('40 300 000 600' => false), array('40 003 000 600' => true)), array(array('20 600 000 028' => false), array('20 600 028 000' => false), array('20 060 028 000' => false), array('20 060 000 028' => true)));
     $alea1 = rand(0, 9);
     //Question 2
     $aines = array('unites', 'dizaines', 'centaines', 'milliers');
     $iemes = array('dixièmes', 'centièmes', 'millièmes');
     $aleas = array(rand(2, 9), rand(2, 9), rand(2, 9));
     $nombre = $aleas[0] * 1000 + $aleas[1] * 100 + $aleas[2] * 10;
     $qtype2 = $this->formateur->formaterDecimalFilter($nombre / 10) . ' dizaines = ...';
     $coupe1 = rand(2, 3);
     if ($coupe1 == 2) {
         $rep3 = $this->formateur->formaterDecimalFilter($aleas[0] * 10 + $aleas[1]) . ' centaines et ' . $this->formateur->formaterDecimalFilter($aleas[2] * 10) . ' unités';
     } else {
         $rep3 = $aleas[0] . ' milliers et ' . ($aleas[1] * 100 + $aleas[2] * 10) . ' unités';
     }
     $coupe2 = rand(0, 2);
     $tmp = $nombre;
     for ($i = 0; $i <= $coupe2; $i++) {
         $tmp *= 10;
     }
     $rep4 = $this->formateur->formaterDecimalFilter($tmp) . ' ' . $iemes[$coupe2];
     $rtype2 = array(array($this->formateur->formaterDecimalFilter($nombre) . ' unités' => true), array($rep3 => true), array($aleas[2] . ' unités' => false), array($rep4 => true));
     //Question 3
     $unites = array('un millième', 'un centième', 'un dixième', 'une unité', 'une dizaine', 'une centaine', 'un millier', 'un million', 'un milliard');
     $valeur = rand(3, 7);
     $qtype3 = 'Parmis ces quantités, lesquelles sont plus petites qu\'' . $unites[$valeur] . ' ?';
     $plusgrand = rand($valeur + 1, 8);
     $pluspetit1 = rand(0, $valeur - 3);
     $pluspetit2 = rand($pluspetit1 + 1, $valeur - 2);
     $pluspetit3 = rand($pluspetit2 + 1, $valeur - 1);
     $rtype3 = array(array($unites[$pluspetit1] => true), array($unites[$pluspetit2] => true), array($unites[$pluspetit3] => true), array($unites[$plusgrand] => false));
     //Question 4
     $unites = array('million(s)', 'centaine(s) de milliers', 'dizaine(s) de milliers', 'millier(s)', 'centaine(s)', 'dizaine(s)', 'unite(s)');
     $nbzeros = 0;
     while ($nbzeros < 3 or $nbzeros > 5) {
         $nbzeros = 0;
         $qtype4 = '';
         $zeros = array();
         for ($i = 0; $i < 7; $i++) {
             $nb[$i] = rand(0, 1) * rand(0, 1) * rand(0, 9);
             if ($nb[$i] == 0) {
                 $zeros[] = $i;
                 $nbzeros++;
             } else {
                 $qtype4 .= $nb[$i] . ' ' . $unites[$i] . ', ';
             }
         }
     }
     $qtype4 = substr($qtype4, 0, -2);
     $nombre = $nb[0] * 1000000 + $nb[1] * 100000 + $nb[2] * 10000 + $nb[3] * 1000 + $nb[4] * 100 + $nb[5] * 10 + $nb[6];
     for ($i = 0; $i < 3; $i++) {
         $decale = $zeros[rand(0, $nbzeros - 1)];
         for ($j = $decale; $j < 6; $j++) {
             $nb[$j] = $nb[$j + 1];
         }
         $newpos = rand(0, 6);
         for ($j = 5; $j >= $newpos; $j--) {
             $nb[$j + 1] = $nb[$j];
         }
         $nb[$newpos] = 0;
     }
     $faux1 = $nb[0] * 1000000 + $nb[1] * 100000 + $nb[2] * 10000 + $nb[3] * 1000 + $nb[4] * 100 + $nb[5] * 10 + $nb[6];
     $faux2 = $faux1;
     while ($faux2 == $faux1 or $faux2 == $nombre) {
         for ($i = 0; $i < 2; $i++) {
             $decale = $zeros[rand(0, $nbzeros - 1)];
             for ($j = $decale; $j < 6; $j++) {
                 $nb[$j] = $nb[$j + 1];
             }
             $newpos = rand(0, 6);
             for ($j = 5; $j >= $newpos; $j--) {
                 $nb[$j + 1] = $nb[$j];
             }
             $nb[$newpos] = 0;
         }
         $faux2 = $nb[0] * 1000000 + $nb[1] * 100000 + $nb[2] * 10000 + $nb[3] * 1000 + $nb[4] * 100 + $nb[5] * 10 + $nb[6];
     }
     $faux3 = $faux2;
     while ($faux3 == $faux2 or $faux3 == $faux1 or $faux3 == $nombre) {
         $decale = $zeros[rand(0, $nbzeros - 1)];
         for ($j = $decale; $j < 6; $j++) {
             $nb[$j] = $nb[$j + 1];
         }
         $newpos = rand(0, 6);
         for ($j = 5; $j >= $newpos; $j--) {
             $nb[$j + 1] = $nb[$j];
         }
         $nb[$newpos] = 0;
         $faux3 = $nb[0] * 1000000 + $nb[1] * 100000 + $nb[2] * 10000 + $nb[3] * 1000 + $nb[4] * 100 + $nb[5] * 10 + $nb[6];
     }
     $rtype4 = array(array($this->formateur->formaterDecimalFilter($nombre) => true), array($this->formateur->formaterDecimalFilter($faux1) => false), array($this->formateur->formaterDecimalFilter($faux2) => false), array($this->formateur->formaterDecimalFilter($faux3) => false));
     //Mise en commun
     $this->questions = array($qtype1[$alea1], $qtype2, $qtype3, $qtype4);
     $this->reponses = array($rtype1[$alea1], $rtype2, $rtype3, $rtype4);
     foreach ($this->reponses as $cle => $val) {
         shuffle($this->reponses[$cle]);
     }
 }