"); $i++; } end_table(); break; case BOLT_MODE_SCORE: $right_ans = $choices[0]; shuffle($choices); $response = $_GET["q_$bolt_ex_index"]; if ($choices[$response] == $right_ans) { $bolt_ex_score = 1; } else { $bolt_ex_score = 0; } $bolt_ex_response = "$bolt_ex_index: $choices[$response]"; break; case BOLT_MODE_ANSWER: $right_ans = $choices[0]; shuffle($choices); $response = $_GET["q_$bolt_ex_index"]; $i = 0; start_table(); foreach ($choices as $choice) { $x = ""; if ($response == $i) $x .= "(You chose this) "; if ($choice == $right_ans) $x .= "(Right answer)"; row2($choice, $x); $i++; } end_table(); break; } $bolt_ex_index++; } function bolt_inclusive_choice($choices) { global $bolt_ex_mode; // input global $bolt_ex_index; // input global $bolt_ex_score; // output if SCORE global $bolt_ex_response; // output if SCORE switch ($bolt_ex_mode) { case BOLT_MODE_SHOW: shuffle($choices); $i = 0; start_table(); foreach ($choices as $choice) { $c = $choice[0]; row2($c, ""); $i++; } end_table(); break; case BOLT_MODE_SCORE: $i = 0; $n = count($choices); $score = 0; shuffle($choices); foreach ($choices as $choice) { $response = $_GET["q_".$bolt_ex_index."_$i"]; $r = $choice[1]; $correct = ($r && $response) || (!$r && !$response); if ($correct) $score += 1./$n; } $bolt_ex_response = "$bolt_ex_index: $choices[$response]"; break; case BOLT_MODE_ANSWER: $i = 0; $n = count($choices); shuffle($choices); start_table(); foreach ($choices as $choice) { $c = $choice[0]; $response = $_GET["q_$bolt_ex_index_$i"]; $r = $choice[1]; $correct = ($r && $response) || (!$r && !$response); row2($c, $x); $i++; } end_table(); break; } $bolt_ex_index++; } function bolt_image_rect($img, $rect) { global $bolt_ex_mode; // input global $bolt_ex_index; // input global $bolt_ex_state; // output if SHOW, else input global $bolt_ex_score; // output if SCORE switch ($bolt_ex_mode) { case BOLT_MODE_SHOW: echo "