// Numbas version: exam_results_page_options {"name": "Construct a polygon point by point", "extensions": ["geogebra"], "custom_part_types": [{"source": {"pk": 1, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/1/edit"}, "name": "Yes/no", "short_name": "yes-no", "description": "

The student is shown two radio choices: \"Yes\" and \"No\". One of them is correct.

", "help_url": "", "input_widget": "radios", "input_options": {"correctAnswer": "if(eval(settings[\"correct_answer_expr\"]), 0, 1)", "hint": {"static": true, "value": ""}, "choices": {"static": true, "value": ["Yes", "No"]}}, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=correct_answer,\n correct(),\n incorrect()\n)\n\ninterpreted_answer:\nstudentAnswer=0\n\ncorrect_answer:\nif(eval(settings[\"correct_answer_expr\"]),0,1)", "marking_notes": [{"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=correct_answer,\n correct(),\n incorrect()\n)"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "studentAnswer=0"}, {"name": "correct_answer", "description": "", "definition": "if(eval(settings[\"correct_answer_expr\"]),0,1)"}], "settings": [{"name": "correct_answer_expr", "label": "Is the answer \"Yes\"?", "help_url": "", "hint": "An expression which evaluates to true or false.", "input_type": "mathematical_expression", "default_value": "true", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Construct a polygon point by point", "tags": [], "metadata": {"description": "

This question demonstrates how to use GeoGebra applets in explore mode.

\n

The student must construct a polygon by adding points one at a time. At any point, they can answer the question, \"Is the centroid inside the polygon?\"

\n

GeoGebra's IsInRegion command is used to decide if the centroid is inside the polygon.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "extensions": ["geogebra"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"points": {"name": "points", "group": "Ungrouped variables", "definition": "[\n vector(0,0),\n vector(1,0)\n]", "description": "", "templateType": "anything", "can_override": false}, "centroid": {"name": "centroid", "group": "Ungrouped variables", "definition": "vector(\n sum_x,\n sum_y\n)/len(points)", "description": "", "templateType": "anything", "can_override": false}, "sum_x": {"name": "sum_x", "group": "Ungrouped variables", "definition": "sum(map(v[0],v,points))", "description": "", "templateType": "anything", "can_override": false}, "sum_y": {"name": "sum_y", "group": "Ungrouped variables", "definition": "sum(map(v[1],v,points))", "description": "", "templateType": "anything", "can_override": false}, "show_centroid_applet": {"name": "show_centroid_applet", "group": "Ungrouped variables", "definition": "geogebra_applet(500,500,\n [\n \"points\": [\n \"definition\": points,\n \"visible\": true\n ],\n \"p\": \"Polygon(points)\",\n \"C\": [\n \"definition\": centroid,\n \"fixed\": true\n ],\n \"contained\": \"IsInRegion(C,p)\"\n ]\n)", "description": "

An applet showing the position of the centroid.

", "templateType": "anything", "can_override": false}, "show_points_applet": {"name": "show_points_applet", "group": "Ungrouped variables", "definition": "geogebra_applet(500,500,\n [\n \"points\": [\n \"definition\": points,\n \"visible\": true\n ],\n \"p\": \"Polygon(points)\"\n ]\n)", "description": "

An applet showing just the points defined so far.

", "templateType": "anything", "can_override": false}, "test_centroid_applet": {"name": "test_centroid_applet", "group": "Ungrouped variables", "definition": "geogebra_applet(500,500,\n [\n \"points\": points,\n \"p\": \"Polygon(points)\",\n \"C\": [\n \"definition\": centroid,\n \"visible\": false\n ],\n \"contained\": \"IsInRegion(C,p)\"\n ]\n)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["points", "sum_x", "sum_y", "show_points_applet", "centroid", "show_centroid_applet", "test_centroid_applet"], "variable_groups": [], "functions": {"add_point_applet": {"parameters": [["points", "list"], ["part_path", "string"]], "type": "ggbapplet", "language": "jme", "definition": "geogebra_applet(500,500,\n [\n \"points\": [\n \"definition\": points,\n \"visible\": true\n ],\n \"p\": \"Polygon(points)\",\n \"A\": vector(0.5,0.5)\n ],\n [\n [\"A\",part_path]\n ]\n)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "matrix", "useCustomName": true, "customName": "Add a point", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Show the points", "rawLabel": "", "otherPart": 1, "variableReplacements": [{"variable": "points", "definition": "points+[transpose(interpreted_answer)[0]]"}], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}, {"label": "Add another point", "rawLabel": "Add another point", "otherPart": 0, "variableReplacements": [{"variable": "points", "definition": "points+[transpose(interpreted_answer)[0]]"}], "availabilityCondition": "answered", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

{add_point_applet(points,part_path)}

\n

Add a point to the polygon.

\n

Either write the coordinates below or move the point $A$ in the diagram above.

", "correctAnswer": "vector(0,0)", "correctAnswerFractions": false, "numRows": "2", "numColumns": 1, "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0, "prefilledCells": ""}, {"type": "information", "useCustomName": true, "customName": "Show the points", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Is the centroid in the polygon?", "rawLabel": "", "otherPart": 2, "variableReplacements": [], "availabilityCondition": "len(points)>=3", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}, {"label": "Add a point", "rawLabel": "", "otherPart": 0, "variableReplacements": [], "availabilityCondition": "", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

{show_points_applet}

"}, {"type": "yes-no", "useCustomName": true, "customName": "Is the centroid in the polygon?", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "correct_answer:\n if(value(test_centroid_applet,\"contained\"),0,1)", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "Show the centroid", "rawLabel": "", "otherPart": 3, "variableReplacements": [], "availabilityCondition": "not (answered and credit=1)", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "Is the centroid in the polygon?", "prompt": "

{test_centroid_applet}

\n

Is the centroid of this polygon inside the polygon?

", "settings": {"correct_answer_expr": "true"}}, {"type": "information", "useCustomName": true, "customName": "Show the centroid", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

{show_centroid_applet}

\n

The centroid is at $\\var{precround(centroid,2)}$.

"}], "partsMode": "explore", "maxMarks": 0, "objectives": [{"name": "Is the centroid in the polygon?", "limit": "2"}], "penalties": [{"name": "Centroid shown", "limit": "1"}], "objectiveVisibility": "always", "penaltyVisibility": "when-active", "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/"}]}