// Numbas version: exam_results_page_options {"name": "Diagram showing a partition of a number", "extensions": ["eukleides"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Diagram showing a partition of a number", "tags": [], "metadata": {"description": "

A Eukleides diagram showing a list of numbers, each in their own box, with the sum drawn above.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

{max_height(10, diagram)}

", "advice": "", "rulesets": {}, "extensions": ["eukleides"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"diagram": {"name": "diagram", "group": "Ungrouped variables", "definition": "let(\n boxes, numbers,\n w, 1.5,\n h, 1,\n gap, 0.2,\neukleides(\"\"\"Boxes labelled {join(boxes, \", \")}, summing to {sum(boxes)}\"\"\",\n [ map(\n let(p, point(w*i,0),\n [\n polygon(rectangle(p,w,h)) filled if(n<0, color2, color1) opacity(0.5),\n polygon(rectangle(p,w,h)),\n (p+vector(w/2,h/2)) text(string(n)) description(string(n))\n ]\n ),\n [n,i],\n zip(boxes, 0..len(boxes)-1)\n )\n , point(0,h+0.1)..point(0,h+gap)..point(w*len(boxes),h+gap)..point(w*len(boxes),h+0.1) open\n , point(w*len(boxes)/2, h+gap)..point(w*len(boxes)/2, h+2*gap)\n , point(w*len(boxes)/2, h+3*gap) text(string(sum(boxes))) description(\"Sum {sum(boxes)}\")\n ]\n)\n)", "description": "

A diagram showing the list of numbers and their sum. Negative numbers are shown in a different colour to positive numbers.

", "templateType": "anything", "can_override": false}, "numbers": {"name": "numbers", "group": "Ungrouped variables", "definition": "sort(repeat(random(-10..10 except 0), random(3..6)))", "description": "

Some randomly chosen numbers.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["numbers", "diagram"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "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/"}]}