GIANT & MINI / STUDY / LEVEL 4 OF 5
Things from
a prompt.
Either player can type what they want: the giant gets a building, the mini gets furniture. The AI is not asked for code and nothing it returns is ever run. It is asked for a list of parts, each one a simple solid with a place, a size and a colour, in feet as the mini measures them. That list passes through one function before anything is drawn. Parts with an unknown shape or a bad number are thrown away. Sizes are clamped, places are pulled back inside the allowed box, colours are clamped, and the count is capped. If the mini is standing in a room, the AI is told the room's size, and a result that is still too big is shrunk evenly. This page has no AI behind it: below are saved answers, some of them deliberately bad, and you can edit them.
What gets drawn
the figure is a mini, 5.5 ft tallThe AI's answer
edit it and watchThe prompt the scene would send
The validator
things.jsSizes are clamped first and places second, so that a part's whole extent, not just its centre, ends up inside the box. The name is reduced to capital letters, digits and spaces before it is ever shown.
Fitting a room
things.jsOne factor for every place and every size keeps the shape. Clamping each part on its own would squash a bed into a cube.
Drawing parts, in sections
thingView.jsEvery engine shape fills a box from −1 to 1. A part is drawn by moving to its centre (its bottom plus half its height) and scaling by half its size. Parts of one section share a node, so lifting a section is one translation of that node.
What you should be able to explain
- Data, not code. The answer is parsed as JSON and read field by field. A field the validator does not know, such as
codein the bad answer, is simply never looked at. - Why clamp instead of refuse. A model that is slightly over a limit has still made something useful. Refusal is kept for answers with nothing usable in them.
- One ruler for both players. Buildings and furniture are both in the mini's feet, drawn at one inch per foot. A mini's 6-foot bed therefore fits a giant's 10-foot cottage without any conversion.
- Taking a building apart. A second request asks the AI to rebuild the same building with a
sectionnumber on every part and an empty inside. The building stays one object: the trigger moves all of it, and the grip changes one section's offset. Released near its place the offset is deleted and it is back on; released elsewhere it is lowered until its underside meets the desk.
Exercises: ① In the lighthouse, change one "cylinder" to "teapot". What happens to the count, and to the picture? ② Load the bed, untick the room, tick it again. By what factor is it shrunk, and which of the three directions decided it? ③ In the bad answer, why does the part at [900, 900, 900] still appear, and where?