// Numbas version: finer_feedback_settings {"name": "Drag a point into a region", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "", "variables": {"x1": {"description": "", "name": "x1", "templateType": "anything", "definition": "x0+random(4..6)", "group": "Ungrouped variables"}, "y1": {"description": "", "name": "y1", "templateType": "anything", "definition": "y0+random(4..5)", "group": "Ungrouped variables"}, "y0": {"description": "", "name": "y0", "templateType": "anything", "definition": "random(1,4)", "group": "Ungrouped variables"}, "x0": {"description": "", "name": "x0", "templateType": "anything", "definition": "random(-9,4)", "group": "Ungrouped variables"}}, "metadata": {"description": "

Drag a point into a square!

", "licence": "Creative Commons Attribution 4.0 International"}, "rulesets": {}, "extensions": ["jsxgraph"], "preamble": {"js": "", "css": ""}, "variablesTest": {"maxRuns": 100, "condition": ""}, "name": "Drag a point into a region", "ungrouped_variables": ["x0", "y0", "x1", "y1"], "parts": [{"prompt": "

{dragpoints()}

", "useCustomName": false, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "type": "extension", "marks": 1, "showCorrectAnswer": true, "unitTests": [], "variableReplacements": [], "customMarkingAlgorithm": "", "scripts": {"mark": {"script": "this.answered = true;\nvar variables = this.question.scope.variables;\nvar unwrap = Numbas.jme.unwrapValue;\nvar x0 = unwrap(variables.x0);\nvar x1 = unwrap(variables.x1);\nvar y0 = unwrap(variables.y0);\nvar y1 = unwrap(variables.y1);\n\n\nif(this.question.points.p.X() > x0 && this.question.points.p.X() < x1 && this.question.points.p.Y() > y0 && this.question.points.p.Y() < y1){\n this.setCredit(1,'You are in the square.');\n}else{\n this.setCredit(0,'You are not in the square!');\n}", "order": "instead"}}, "customName": ""}], "statement": "

Move the point inside the square.

", "variable_groups": [], "functions": {"dragpoints": {"type": "html", "parameters": [], "language": "javascript", "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-11,11,11,-11],grid:false,axis:false});\nvar board = div.board;\nquestion.board = board;\n\nvar x0 = Numbas.jme.unwrapValue(scope.variables.x0);\nvar x1 = Numbas.jme.unwrapValue(scope.variables.x1);\nvar y0 = Numbas.jme.unwrapValue(scope.variables.y0);\nvar y1 = Numbas.jme.unwrapValue(scope.variables.y1);\n\n\nvar p = board.create('point',[0,0],{name: '', size: 7, fillColor: 'blue' , strokeColor: 'lightblue' , highlightFillColor: 'lightblue', highlightStrokeColor: 'yellow', snapToGrid: true, showInfobox: false});\n\nvar f1 = function() { return [x0, y0]; },\n f2 = function() { return [x1, y0]; },\n f3 = function() { return [x1, y1]; },\n f4 = function() { return [x0, y1]; },\n cc1 = board.create('polygon', [f1, f2, f3, f4],{vertices: {visible:false}});\n\nquestion.points = {\n p:p\n}\n\np.on('drag',function(){\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(p.X());\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(p.Y());\n});\n\n\nreturn div;\n\n"}}, "tags": [], "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}