// Numbas version: exam_results_page_options {"name": "Deirdre's copy of Mark an equation - check left and right sides", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "", "functions": {}, "preamble": {"css": "", "js": ""}, "metadata": {"notes": "", "description": "

In progress!

", "licence": "Creative Commons Attribution 4.0 International"}, "ungrouped_variables": [], "tags": ["custom marking"], "statement": "", "name": "Deirdre's copy of Mark an equation - check left and right sides", "type": "question", "parts": [{"checkingaccuracy": 0.001, "prompt": "

Write the equation $4x^2=\\cos(x)$

", "checkingtype": "absdiff", "answer": "4x^2=cos(x)", "expectedvariablenames": [], "showpreview": true, "scripts": {"mark": {"order": "instead", "script": "// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match\nvar rule = new Numbas.jme.display.Rule('?;left=?;right',[],'');\n\n// Match the student's expression against the pattern\nvar m = rule.match(studentTree);\n\nif(!m) {\n this.setCredit(0,'Your answer is not an equation.');\n return;\n}\n\n// Get the left- and right-hand sides of the equation, and convert them to JME\nvar left = Numbas.jme.display.treeToJME(m.left);\nvar right = Numbas.jme.display.treeToJME(m.right);\n\n// Check the left-hand side is correct\nif(Numbas.jme.compare(left,'4x^2',this.settings,this.markingScope)) {\n this.addCredit(0.5,'Left part is OK');\n}\n\n// Check the right-hand side is correct\nif(Numbas.jme.compare(right,'cos(x)',this.settings,this.markingScope)) {\n this.addCredit(0.5,'Right part is OK');\n}"}}, "checkvariablenames": false, "marks": 1, "type": "jme", "vsetrange": [0, 1], "showCorrectAnswer": true, "vsetrangepoints": 5}], "progress": "in-progress", "showQuestionGroupNames": false, "variables": {}, "variablesTest": {"maxRuns": 100, "condition": ""}, "question_groups": [{"name": "", "pickQuestions": 0, "questions": [], "pickingStrategy": "all-ordered"}], "variable_groups": [], "rulesets": {}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Deirdre Casey", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/681/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Deirdre Casey", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/681/"}]}