POCKET CITY / STUDY / LEVEL 3 OF 5

The
prompt.

The AI knows nothing about lots, cubes or your table. Everything it needs travels in one message: the job ("four different buildings in the neighbouring lots"), the vocabulary (integer cells, four materials, a block needs support), the exact JSON shape to answer with, and your example as text. Your example is the only thing in the message that changes. This page builds that message with the scene's own cityPrompt, and shows a reply in the shape the AI returns.

snapshota copy of the example at the moment GROW is pressed
→
cityPrompt(snapshot)job + rules + reply shape + the list
→
askAIJson, 30 s timeoutthrough the course server, which holds the key
→
a JSON replytitle and four buildings of blocks (level 4 checks it)

What is sent

your examplethe jobthe vocabularythe reply's shape

Your example

pick one; the message updates

A saved reply is drawn on the blue lots so you can see the shape the AI answers in. It is a stand-in: this page has no server and no key.

The prompt

pocketCityRules.js

One template string. The rules in the middle are the same ones validateCityResponse enforces (level 4): asking for them and checking for them are two halves of one contract. The example is inserted with JSON.stringify, in the same block format the reply must use, so the AI sees the language by example as well as by description.


      

Sending it

pocketCity.js

generate refuses a second request while one is running and an example under four blocks. It numbers each request and copies the example, so a reply to an old request, or one that arrives after the example changed, is dropped. Failure keeps the example and says so.


      
    

What you should be able to explain

  1. Demonstration as data. "Teaching by example" here means: the example is literally pasted into the message, in the same format the answer must take. The AI copies, varies and extends what it sees.
  2. A closed vocabulary makes a reply checkable. Because the prompt only allows integers 0–2, layers 0–5 and four material names, every word of the reply can be tested. Free text could not be.
  3. What the AI does not know. It is told nothing about where the lots are, which side faces the player, or what a street is. That is a limit of this draft, and the first thing to add next.
  4. Requests have ids. The scene is still running while the AI thinks. The id and the snapshot make sure a late answer never overwrites a newer example.

Exercises: ① Which sentence stops the AI from returning three buildings? Which one stops a floating cube? ② Pick the "tower" example: what in the message tells the AI that the tower is five high? ③ What would you add to the message so the four buildings face the same street?