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.

thingPrompt(text, role, room)units, shapes, limits, real-life sizes, the JSON form
→
validateThing(answer, role)keep, clamp or throw away, part by part
⇒
fitThing · thingViewshrink to the room if needed; one node per section

What gets drawn

the figure is a mini, 5.5 ft tall

The AI's answer

edit it and watch

The prompt the scene would send


      

The validator

things.js

Sizes 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.js

One 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.js

Every 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

  1. Data, not code. The answer is parsed as JSON and read field by field. A field the validator does not know, such as code in the bad answer, is simply never looked at.
  2. 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.
  3. 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.
  4. Taking a building apart. A second request asks the AI to rebuild the same building with a section number 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?