// Numbas version: finer_feedback_settings {"name": "Joshua's copy of JSXGraph test", "extensions": ["jsxgraph"], "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": "

Experimental question using JSXGraph to provide dynamic, interactive graphs.

"}, "functions": {"dragpoint": {"parameters": [], "type": "html", "language": "javascript", "definition": "\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[-10,10,10,-10],grid:false});\nvar board = div.board;\n\nvar x = Numbas.jme.unwrapValue(scope.variables.a);\nvar y = Numbas.jme.unwrapValue(scope.variables.b);\n\nvar a = board.create('point',[x,y],'$A$');\na.on('drag',function(){\n var x = Numbas.math.niceNumber(a.X());\n var y = Numbas.math.niceNumber(a.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(a.X());\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(y);\n});\n\nboard.create('line',[[0,2],[1,4]]);\n\nquestion.signals.on('HTMLAttached',function(e) {\n ko.computed(function(){ \n console.log(\"Hi\");\n var x = parseFloat(question.parts[0].gaps[0].display.studentAnswer());\n var y = parseFloat(question.parts[0].gaps[1].display.studentAnswer());\n var s0 =temp.gaps[2].display.ticks[0]();\n var s1 =temp.gaps[2].display.ticks[1]();\n var s2 =temp.gaps[2].display.ticks[2]();\n\n if(!(isNaN(x) || isNaN(y)) && board.mode!=board.BOARD_MODE_DRAG) {\n a.moveTo([x,y],100);\n \n }\n });\n});\n\ntemp=question.parts[0];\n\nreturn div;\n\n"}, "polarplot": {"parameters": [], "type": "html", "language": "javascript", "definition": "\n var div = Numbas.extensions.jsxgraph.makeBoard('600px','400px',{\nboundingBox:[-6,4,6,-4],\ngrid: false,\nshowNavigation: false\n });\n var board = div.board;\n \n var tree;\n var nscope = new Numbas.jme.Scope([scope,{variables:{t:new Numbas.jme.types.TNum(0)}}]);\n var curve = board.create('curve',[function(t){\nif(tree) {\n try {\nnscope.variables.t.value = t;\n var val = Numbas.jme.evaluate(tree,nscope).value;\n return val;\n }\n catch(e) {\nreturn 0;\n }\n}\nelse\n return 0;\n },[0,0]],0,2*Math.PI);\n \n question.signals.on('HTMLAttached',function(e) {\nko.computed(function(){\nvar expr = question.parts[2].gaps[0].display.studentAnswer();\ntry {\n tree = Numbas.jme.compile(expr,scope);\n}\ncatch(e) {\n tree = null;\n}\ncurve.updateCurve();\nboard.update();\n});\n });\n \n return div;\n "}}, "variables": {"b": {"definition": "2", "description": "", "name": "b", "templateType": "anything", "group": "Ungrouped variables"}, "a": {"definition": "1", "description": "", "name": "a", "templateType": "anything", "group": "Ungrouped variables"}}, "variable_groups": [], "rulesets": {}, "name": "Joshua's copy of JSXGraph test", "advice": "", "variablesTest": {"maxRuns": 100, "condition": ""}, "statement": "", "tags": [], "ungrouped_variables": ["b", "a"], "parts": [{"prompt": "

This part demonstrates a binding between the properties of an element in the graph and values entered in the answer boxes.

\n

Place the dot at $(\\var{a},\\var{b})$. You can either drag the dot or enter coordinates in the box.

\n

{dragpoint()}

\n

$X$: [[0]], $Y$: [[1]]

\n

[[2]]

", "showFeedbackIcon": true, "gaps": [{"type": "numberentry", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "correctAnswerFraction": false, "minValue": "a-0.1", "showCorrectAnswer": true, "maxValue": "a+0.1", "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "marks": 1, "allowFractions": false, "scripts": {}}, {"type": "numberentry", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "correctAnswerFraction": false, "minValue": "b-0.1", "showCorrectAnswer": true, "maxValue": "b+0.1", "variableReplacements": [], "correctAnswerStyle": "plain", "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "marks": 1, "allowFractions": false, "scripts": {}}, {"maxAnswers": 0, "showFeedbackIcon": true, "choices": ["Choice 1", "Choice 2", "Choice 3"], "variableReplacementStrategy": "originalfirst", "displayType": "checkbox", "type": "m_n_2", "showCorrectAnswer": true, "variableReplacements": [], "matrix": [0, 0, 0], "distractors": ["", "", ""], "displayColumns": 0, "maxMarks": 0, "scripts": {}, "minMarks": 0, "marks": 0, "minAnswers": 0, "shuffleChoices": false, "warningType": "none"}], "variableReplacementStrategy": "originalfirst", "type": "gapfill", "showCorrectAnswer": true, "marks": 0, "scripts": {}, "variableReplacements": []}], "extensions": ["jsxgraph"], "preamble": {"js": "", "css": ""}, "type": "question", "contributors": [{"name": "Joshua Capel", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1479/"}]}]}], "contributors": [{"name": "Joshua Capel", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1479/"}]}