Skip to content
Snippets Groups Projects
Commit cb352dc4 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Updates to the renderer.php

parent 4b473379
Branches
No related tags found
No related merge requests found
...@@ -60,7 +60,7 @@ Hence, we need quite a number of different answer tests to establish equality in ...@@ -60,7 +60,7 @@ Hence, we need quite a number of different answer tests to establish equality in
| Test | Description | Test | Description
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| CASEqual | Are the parse trees of the two expressions equal? | CASEqual | Are the parse trees of the two expressions equal?
| Equal_com_ass | Are they equal up to commutativity and associativity of addition and multiplication, together with their inverses minus and division? For example<br>\[a+b=b+a\mbox{,}\]<br>but<br>\[x+x\neq 2x\mbox{.}\]<br>This is very useful in elementary algebra, where we want the form of the answer exactly. Simplification is automatically switched off when this test is applied, otherwise it makes no sense. | EqualComAss | Are they equal up to commutativity and associativity of addition and multiplication, together with their inverses minus and division? For example<br>\[a+b=b+a\mbox{,}\]<br>but<br>\[x+x\neq 2x\mbox{.}\]<br>This is very useful in elementary algebra, where we want the form of the answer exactly. Simplification is automatically switched off when this test is applied, otherwise it makes no sense.
| [AlgEquiv](Answer_tests#AlgEquiv) | Are they _algebraically equivalent_, i.e. does the difference simplify to zero? | [AlgEquiv](Answer_tests#AlgEquiv) | Are they _algebraically equivalent_, i.e. does the difference simplify to zero?
| SubstEquiv | Can we find a substitution of the variables of \(ex_2\) into \(ex_1\) which renders \(ex_1\) algebraically equivalent to \(ex_2\)? If you are only interested in ignoring case sensitivity, you can apply the [Maxima commands defined by STACK](../CAS/Maxima#Maxima_commands_defined_by_STACK) `exdowncase(ex)` to the arguments, before you apply one of the other answer tests. | SubstEquiv | Can we find a substitution of the variables of \(ex_2\) into \(ex_1\) which renders \(ex_1\) algebraically equivalent to \(ex_2\)? If you are only interested in ignoring case sensitivity, you can apply the [Maxima commands defined by STACK](../CAS/Maxima#Maxima_commands_defined_by_STACK) `exdowncase(ex)` to the arguments, before you apply one of the other answer tests.
| SameType | Are the two expressions of the [types_of_object](../CAS/Maxima#Types_of_object)? Note that this test works recursively over the entire expression. | SameType | Are the two expressions of the [types_of_object](../CAS/Maxima#Types_of_object)? Note that this test works recursively over the entire expression.
......
...@@ -39,11 +39,6 @@ require_once(dirname(__FILE__) . '/stack/potentialresponsetree.class.php'); ...@@ -39,11 +39,6 @@ require_once(dirname(__FILE__) . '/stack/potentialresponsetree.class.php');
*/ */
class qtype_stack_question extends question_graded_automatically { class qtype_stack_question extends question_graded_automatically {
/**
* @var int STACK specific: seeds Maxima's random number generator.
*/
public $seed;
/** /**
* @var array STACK specific: string name as it appears in the question text => stack_interaction_element * @var array STACK specific: string name as it appears in the question text => stack_interaction_element
*/ */
...@@ -54,11 +49,6 @@ class qtype_stack_question extends question_graded_automatically { ...@@ -54,11 +49,6 @@ class qtype_stack_question extends question_graded_automatically {
*/ */
public $questionvariables; public $questionvariables;
/**
* @var stack_cas_session Stores STACK specific: the variables actually created by the question.
*/
public $session;
/** /**
* @var array stack_potentialresponse_tree STACK specific: respones tree number => ... * @var array stack_potentialresponse_tree STACK specific: respones tree number => ...
*/ */
...@@ -72,14 +62,13 @@ class qtype_stack_question extends question_graded_automatically { ...@@ -72,14 +62,13 @@ class qtype_stack_question extends question_graded_automatically {
public function start_attempt(question_attempt_step $step, $variant) { public function start_attempt(question_attempt_step $step, $variant) {
$seed = time(); $seed = time();
$this->seed = $seed; $step->set_qt_var('_seed') = $seed;
$questionvars = new stack_cas_keyval($this->questionvariables); $questionvars = new stack_cas_keyval($this->questionvariables);
$qtext = new stack_cas_text($this->questiontext, $questionvars->get_session(), $seed, 't', false, true); $qtext = new stack_cas_text($this->questiontext, $questionvars->get_session(), $seed, 't', false, true);
//TODO error trapping if a question version breaks things. //TODO error trapping if a question version breaks things.
//TODO should we over write $this->questiontext or use another field here? $step->set_qt_var('_questiontext', $qtext->get_display_castext());
$this->questiontext = $qtext->get_display_castext(); $step->set_qt_var('_session', $qtext->get_session());
$this->session = $qtext->get_session();
} }
public function apply_attempt_state(question_attempt_step $step) { public function apply_attempt_state(question_attempt_step $step) {
...@@ -121,4 +110,12 @@ class qtype_stack_question extends question_graded_automatically { ...@@ -121,4 +110,12 @@ class qtype_stack_question extends question_graded_automatically {
public function grade_response(array $response) { public function grade_response(array $response) {
return array(0, question_state::$gradedwrong); return array(0, question_state::$gradedwrong);
} }
/**
* @return int the number of vaiants that this question has.
*/
public function get_num_variants() {
return 1; //TODO
}
} }
...@@ -34,7 +34,7 @@ class qtype_stack_renderer extends qtype_renderer { ...@@ -34,7 +34,7 @@ class qtype_stack_renderer extends qtype_renderer {
public function formulation_and_controls(question_attempt $qa, question_display_options $options) { public function formulation_and_controls(question_attempt $qa, question_display_options $options) {
$question = $qa->get_question(); $question = $qa->get_question();
$questiontext = $question->questiontext; $questiontext = $question->get_qt_var('_questiontext');
if (empty($question->interactions)) { if (empty($question->interactions)) {
$xhtml = '<div class="secondaryFeedback">'.stack_string('stackQuestion_noQuestionParts').'</div>'.$questiontext; $xhtml = '<div class="secondaryFeedback">'.stack_string('stackQuestion_noQuestionParts').'</div>'.$questiontext;
} else { } else {
......
...@@ -47,7 +47,7 @@ class qtype_stack_test_helper extends question_test_helper { ...@@ -47,7 +47,7 @@ class qtype_stack_test_helper extends question_test_helper {
test_question_maker::initialise_a_question($q); test_question_maker::initialise_a_question($q);
$q->name = 'Stack question: test0'; $q->name = 'Stack question: test0';
$q->questionvariables = 'n=rand(3)+2; m=n+rand(3)+2; ta=n+m'; $q->questionvariables = 'n=4; m=2; ta=n+m';
$q->questiontext = 'What is $@n@+@m@$? #ans1# $q->questiontext = 'What is $@n@+@m@$? #ans1#
<IEfeedback>ans1</IEfeedback> <IEfeedback>ans1</IEfeedback>
<PRTfeedback>firsttree</PRTfeedback>'; <PRTfeedback>firsttree</PRTfeedback>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment