$option_mix

This commit is contained in:
CHIEFSOFT\ameye
2024-08-20 10:21:48 -04:00
parent a67ae45d3c
commit 66e9b06c51
+3 -1
View File
@@ -19,13 +19,14 @@ class WrenchResources extends BaseController
$c= $a+$b;
$ansPos = rand(1,4);
$option_mix=[];
for ($ii=1; $ii<=4; $ii++){
if ($ii== $ansPos){
$next_question["option_mix"][]= $c;
}else
{
$ansRand = rand(1000,9999);
$next_question["option_mix"][]= ($ansRand == $c)? $ansRand+rand(1,5) : $ansRand;
$option_mix[]= ($ansRand == $c)? $ansRand+rand(1,5) : $ansRand;
}
}
@@ -35,6 +36,7 @@ class WrenchResources extends BaseController
"question" => "What is C ? <br> C = $a + $b .",
"option" => [ rand(1000,9999), $c , rand(1000,9999)],
"answer" => $c,
'option_mix' => $option_mix,
"last" => false,
"points" => 10
];