$option_mix
This commit is contained in:
@@ -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
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user