. // Bolt exercise API $bolt_ex_mode = 0; $bolt_ex_index = 0; $bolt_ex_state = 0; $bolt_ex_score = 0; $bolt_ex_query_string = ""; function exclusive_choice($choices) { global $bolt_ex_mode; // input global $bolt_ex_index; // input global $bolt_ex_score; // incremental output if SCORE global $bolt_ex_query_string; parse_str($bolt_ex_query_string); switch ($bolt_ex_mode) { case BOLT_MODE_SHOW: shuffle($choices); $i = 0; start_table(); foreach ($choices as $choice) { row2($choice, ""); $i++; } end_table(); break; case BOLT_MODE_SCORE: $right_ans = $choices[0]; shuffle($choices); $key = "q_$bolt_ex_index"; if (isset($$key)) { $response = $$key; if ($choices[$response] == $right_ans) { $bolt_ex_score += 1; } } break; case BOLT_MODE_ANSWER: $right_ans = $choices[0]; shuffle($choices); $key = "q_$bolt_ex_index"; if (isset($$key)) { $response = $$key; } else { $response = -1; } $i = 0; start_table(); foreach ($choices as $choice) { $x = "