Boxes

{ "semantic": { "type": "box", "size": 2, "contents": [ null, null ], "horizontal": true, "running": true }, "view": { "frontside_width": 164, "frontside_height": 68, "frontside_left": 268, "frontside_top": 53, "backside_geometry": { "x_scale": 1, "y_scale": 1, "original_width": 171, "original_height": 39 }, "drag_x_offset": 68, "drag_y_offset": 66 }, "version": 1 }

Boxes are good for putting things in. You or a robot can drop things in the holes of a box and later take them out again. Boxes can hold boxes (that can hold boxes and so on). Try it out here:


{ "semantic": { "type": "top_level", "backside_widgets": [ { "widget": { "semantic": { "type": "box", "size": 2, "contents": [ null, null ], "horizontal": true }, "view": { "frontside_width": 164, "frontside_height": 68, "frontside_left": 21, "frontside_top": 14, "backside_geometry": { "x_scale": 1, "y_scale": 1, "original_width": 171, "original_height": 39 } }, "version": 1 } }, { "widget": { "semantic": { "type": "box", "size": 2, "contents": [ null, null ], "horizontal": true }, "view": { "frontside_width": 164, "frontside_height": 68, "frontside_left": 241, "frontside_top": 15 }, "version": 1 } }, { "widget": { "semantic": { "type": "box", "size": 2, "contents": [ null, null ], "horizontal": true }, "view": { "frontside_width": 164, "frontside_height": 68, "frontside_left": 462, "frontside_top": 17 }, "version": 1 } }, { "widget": { "semantic": { "type": "number", "operator": "+", "numerator": "1", "denominator": "1", "format": "improper_fraction" }, "view": { "frontside_width": 76, "frontside_height": 55, "frontside_left": 19, "frontside_top": 147 }, "version": 1 } }, { "widget": { "semantic": { "type": "number", "operator": "+", "numerator": "2", "denominator": "1", "format": "improper_fraction" }, "view": { "frontside_width": 76, "frontside_height": 55, "frontside_left": 127, "frontside_top": 147, "backside_geometry": { "x_scale": 1, "y_scale": 1, "original_width": 550, "original_height": 200 } }, "version": 1 } }, { "widget": { "shared_widget_index": 0 } }, { "widget": { "semantic": { "type": "bird", "nest": { "shared_widget_index": 0 } }, "view": { "frontside_width": 70, "frontside_height": 102, "frontside_left": 255, "frontside_top": 123.8125 }, "version": 1 } }, { "widget": { "semantic": { "type": "scale", "size": 2, "contents": [ null, null ], "horizontal": true }, "view": { "frontside_width": 123, "frontside_height": 91, "frontside_left": 482, "frontside_top": 126, "backside_geometry": { "x_scale": 1, "y_scale": 1, "original_width": 123, "original_height": 91 } }, "version": 1 } } ] }, "view": { "background_color": "rgba(245, 240, 240, 0.941176)", "frontside_width": 0, "frontside_height": 0, "backside_width": 709, "backside_height": 229, "backside_left": 8, "backside_top": 185.1875, "backside_geometry": { "x_scale": 1, "y_scale": 1, "original_width": 1200, "original_height": 475 }, "drag_x_offset": 634, "drag_y_offset": 207.8125, "backside": true }, "version": 1, "shared_widgets": [ { "semantic": { "type": "nest", "contents": [], "guid": "toontalk_id_1412862675679", "waiting_robots": [] }, "view": { "frontside_width": 116, "frontside_height": 98, "frontside_left": 346, "frontside_top": 131 }, "version": 1 } ] }

Changing the number of holes in a box

You can change the number of holes that a box has. Just open its backside by clicking on the box. Then edit the number of holes. Try it:


{ "semantic": { "type": "top_level", "backside_widgets": [ { "widget": { "semantic": { "type": "box", "size": 2, "contents": [ null, null ], "horizontal": true, "running": true }, "view": { "frontside_width": 164, "frontside_height": 68, "frontside_left": 39, "frontside_top": 36, "backside_geometry": { "x_scale": 1, "y_scale": 1, "original_width": 171, "original_height": 39 } }, "version": 1 } } ] }, "view": { "background_color": "rgba(245, 240, 240, 0.941176)", "frontside_width": 0, "frontside_height": 0, "backside_width": 705, "backside_height": 395, "backside_left": 8, "backside_top": 185.1875, "backside_geometry": { "x_scale": 1, "y_scale": 1, "original_width": 1200, "original_height": 475 }, "drag_x_offset": 395, "drag_y_offset": 293.8125, "backside": true }, "version": 1 }

You can also drop a number in the input area for the number of holes. As always in ToonTalk whatever you can do you can also train a robot to do.

Changing the size of a box

You can change the size of a box by dragging the edges.

Changing the "direction" of the box

You can change a box from one whose holes are horizontal (left or right of each other) to boxes that are vertical (holes are above or below each other). Just click on the box to open it and click the Left to right or Top to bottom button.


This will be replaced by a work area containing 2 things: a box, and the backside of a box. top level widget
{ "semantic": { "type": "top_level", "backside_widgets": [ { "widget": { "shared_widget_index": 0 } }, { "widget": { "shared_widget_index": 0 }, "is_backside": true } ] }, "view": { "background_color": "rgb(245, 240, 240)", "backside_width": 691, "backside_height": 251, "backside_left": 8, "backside_top": 184.1875, "backside": true, "drag_x_offset": 522, "drag_y_offset": 232.8125 }, "version": 1, "shared_widgets": [ { "semantic": { "type": "box", "size": 3, "contents": [ null, null, null ], "horizontal": false, "name": ";;" }, "view": { "frontside_width": 164, "frontside_height": 166, "frontside_left": 29.609375, "frontside_top": 22.171875, "backside_width": 550, "backside_height": 200, "backside_left": 248, "backside_top": 33, "backside_geometry": { "x_scale": 0.7492297520661152, "y_scale": 1.0399999999999998, "original_width": 171, "original_height": 39 }, "saved_width": 164, "saved_height": 166, "backside": false }, "version": 1 } ] }

When a robot uses a box he remembers which hole was involved by counting from the left (or the top if a vertical box).

Labelling the holes of a box

You can add labels to holes to tell others (and yourself if you forget) what each hole is for. Each label ends with ';'.

This will be replaced by a work area containing 2 things: a box, and the backside of a box. top level widget
{ "semantic": { "type": "top_level", "backside_widgets": [ { "widget": { "shared_widget_index": 0 } }, { "widget": { "shared_widget_index": 0 }, "is_backside": true } ] }, "view": { "background_color": "rgb(245, 240, 240)", "backside_width": 979, "backside_height": 371, "backside_left": 8, "backside_top": 184.1875, "advanced_settings_open": true, "backside": true, "drag_x_offset": 240, "drag_y_offset": 249.8125 }, "version": 1, "shared_widgets": [ { "semantic": { "type": "box", "size": 2, "contents": [ { "semantic": { "type": "nest", "contents": [], "guid": "toontalk_id_1429691369045", "serial_number": 4, "name": "Msgs" }, "view": { "saved_width": 116, "saved_height": 98, "backside": false }, "version": 1 }, { "semantic": { "type": "number", "operator": "+", "numerator": "42", "denominator": "1", "format": "mixed_number" }, "view": { "saved_width": 76, "saved_height": 55, "backside": false }, "version": 1 } ], "horizontal": true, "name": "Incoming;data;", "description": "a box that demonstrates labels." }, "view": { "frontside_width": 273, "frontside_height": 68, "frontside_left": 44, "frontside_top": 27, "backside_width": 550, "backside_height": 326, "backside_left": 367, "backside_top": 23, "advanced_settings_open": true, "saved_width": 164, "saved_height": 68, "backside": false }, "version": 1 } ] }

What are boxes a metaphor for?

Boxes are similar to arrays or vectors in other programming languages. They are the main data structure of ToonTalk because they can hold any number of other widgets including other boxes.