// Numbas version: exam_results_page_options {"name": "Custom marking of a matrix entry part", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "", "notes": ""}, "advice": "", "variable_groups": [], "type": "question", "name": "Custom marking of a matrix entry part", "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "parts": [{"type": "matrix", "markPerCell": false, "showCorrectAnswer": true, "numColumns": "2", "correctAnswerFractions": false, "allowResize": false, "prompt": "

Write a $2 \\times 2$ matrix. The feedback will show the bottom-right value.

", "tolerance": 0, "correctAnswer": "id(2)", "scripts": {"mark": {"order": "instead", "script": "// student's answer is held in this.studentAnswer\n// it's a 2d array of the strings the student wrote\n// you have to parse each cell as a number.\n\n\n// this script doesn't really do any marking - it just looks at the bottom-right cell of the student's answer\n\nvar cell = Numbas.util.parseNumber(this.studentAnswer[1][1]);\n\nif(Numbas.util.isNumber(cell)) {\n this.markingComment(\"The bottom right cell is \"+cell);\n this.answered = true;\n this.setCredit(1);\n} else {\n this.invalidCell = true; // used by the validation script so it gives the right error message\n this.answered = false;\n this.setCredit(0,\"The bottom right cell is not a number!\");\n}"}}, "allowFractions": false, "numRows": "2", "marks": 1}], "preamble": {"css": "", "js": ""}, "rulesets": {}, "tags": ["demo"], "showQuestionGroupNames": false, "question_groups": [{"pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [], "name": ""}], "functions": {}, "variables": {}, "statement": "", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}