A house is torn down and its people must find a new home, but nobody else should move
Rebuild the housing and the simplest code reassigns every citizen from scratch, so the whole town changes address and the people who were happy suddenly walk across the map. This entry shows how to move only those who must, in a way that repeats exactly.
Why this works
People stay where they are unless something forces them out. Handling those who may stay first, and only then placing the displaced, keeps change small and makes the same input always produce the same neighbourhood.
When not to use it
It is not worth it when people are only numbers in a total and have no address, or when you want the town to rebalance toward the best fit, for example the nearest house to work. Then a full fresh assignment is the better, simpler choice.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- 35 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "A house is torn down and its people must find a new home, but nobody else should move" (read_entry citizens-rehome-without-shuffling) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP