POCKET CITY / STUDY / LEVEL 1 OF 5
A building is
a list of blocks.
Pocket City lets you teach an AI by building. For that, what you build has to be something an AI can read and write back: not a 3D model, but a short list. Every building is a list of cubes, each cube four values: a cell x, z on a 3×3 lot, a layer y, and a material. The table has one gold lot for your example and four blue lots for the AI. This page runs the scene's own pocketCityRules.js: the grid constants and the two functions that add and remove a block.
The table
15 × 11 cells of 9 cm; your lot is goldThe scene draws every entry of the list as a cube 9 cm wide at cellPos(x, y, z); the AI lots stay empty until level 4.
Build the example
click a cell to stack a cubeexample = the list the AI will receive
The vocabulary
pocketCityRules.jsA tiny, closed vocabulary. CITY fixes the grid, the cell size, where the lots are and how high a column may go; MATERIALS lists the only four kinds. Small on purpose: the AI must speak exactly this language, and the scene can check every word of it (level 4).
Where a press becomes a block
pocketCity.jsThe scene never edits the list in place. addExampleBlock returns a new list, or the same one if nothing could be added; the scene compares the two to know whether to show "placed" or "full". Any change throws away the AI's old city, because the demonstration it was made from no longer exists.
What you should be able to explain
- Data, not geometry. The example is a list of
{x, y, z, kind}. Cubes, nodes and colours are made from it every time it changes; nothing is stored in the 3D objects themselves. The same list can be sent to the AI as text and drawn again at another size (level 5). - Stacking is implied. You never choose
y. A new cube's layer is the number of cubes already in that column, so a column has no holes and the list always describes something that could stand up. - Limits live in the rules.
maxHeight, the 3×3 lot and the four materials are enforced byaddExampleBlock, not by the buttons. The AI's buildings are held to the same rules in level 4. - Why so small. A vocabulary this small can be fully checked, and it makes the comparison the assignment asks for possible: what did the AI keep from my example, and what did it change?
Exercises: ① Stack seven cubes on one cell: what does the seventh press do, and which line decides? ② Erase from a cell with three cubes: which y disappears, and why that one? ③ Write out by hand the list for a 2-cube-high wall across the back row.