Most likely you can infer a really complex set of events from this logic. For example, perform a "dice roll" while at a certain level of hunger (similar to how there's two dice rolls in the linked code that can cause the sim to freak out if stress goes too low). Additionally, the type of food can be inferred from the severity of the sim's state and time of day (e.g. snack vs breakfast vs dinner, etc).
All these "tricks" together, combined with a human's tendency to rationalize observations ("X must've happened because of Y"), can make for something that seems alive. :)
It's also quite mesmerizing to watch the relationships between the different numbers (e.g., the alertness value fluctuates, causing energy to either fall slowly or rise quickly), and all these layers add to the apparent complexity.
"combined with a human's tendency to rationalize observations" -- yes, that's a great explanation of what I meant by "implication is more efficient that simulation"!
One reason SimCity and The Sims were successful was because they were about domains that everyone has a lot of first hand common sense experience with, so players can richly and creatively fill in the gaps with their imagination. But SimEarth and Spore, for example, weren't as successful, because most people don't have first hand day-to-day experience with plate tectonics or space exploration to draw from.
The Sims only has a few things it can do at any point in time, but by rolling some dice and choosing randomly between discrete options weighed by dynamically calculated scores, the otherwise robotic obsessive compulsive behavior gets "dithered" into a smoother more organic stream of life choices.
I think of it like error diffusion dithering, where you only have a palette of 256 colors (or black and white, or an ugly web palette, or whatever), but you're trying to render a full color picture, so you choose the discrete color that's closest enough, then diffuse the error into the surrounding pixels. The human eye blurs those 256 colors into continuous gradients of smooth true colors, and the human brain then recognizes details that aren't actually there, which you can't see if you zoom in on the individual pixels.
The Sims diffuses the errors over time instead of space. For example, if you've gotten a bit grubby, you might wash your hands or take a shower. If you're nearby a sink and the shower is upstairs, then you'll probably just wash your hands, and you won't get as clean as you would have if you'd taken a shower. But then you're left over with some dirtiness that "diffuses" into the next time you wash somehow. If you only washed your hands, then you'll need to wash again sooner somehow, but if you took a shower, you get a longer period of time before your need to wash outweighs your other needs at the moment (or gets lucky thanks to dithering).
The Sims uses random numbers to choose between dynamically scored actions, to achieve "behavioral dithering" to avoid large scale patterns like "behavioral banding" (obsessive compulsive robotic behavior).
The art is in choosing a good spanning "behavior palette" of possible objects and actions, and tuning the scoring parameters and functions of each action that map the character's dynamic state to a numeric score.
The action scores can depend on your motives, and can attenuate based on your distance, and can take into account your relationship and past interactions with the object (so you prefer to sleep on the same side of your own bed instead of on the couch, and you're not allowed to play in bed with your enemies).
Action scores can also be unrealistically contrived to compel desired high level behaviors like leading Sims through the food chain (like a delicious carrot on a stick leading them around the kitchen and into the dining room to finally sit down and eat), or the irresistible "comeandseeme" object (shown in the video demo) that makes everyone in the house drop what they're doing and fawn over a newly born baby, or the diabolical "Crowd Sitter" I made for controlling large crowds of people at weddings and cult meetings.
When in play mode, you can turn a Crowd Sitter on and off with a pie menu, and it directs all people to sit down in front of it, or stand up facing it if there aren't any seats left. It has an effective radius of about 7 tiles (more now), with a quarter pie slice shaped footprint. You can strategically deploy as many sitters as you need, to cover all the seats you want people to sit in or areas you want them to stand (like rows of pews in a church or a circle of benches in a stadium). I made a special routing slot that has a maximum size 54 tile footprint (more now), based on the TV set's routing slot, but on steroids.
Dither is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and video data, and is often one of the last stages of mastering audio to a CD.
The algorithm achieves dithering using error diffusion, meaning it pushes (adds) the residual quantization error of a pixel onto its neighboring pixels, to be dealt with later. It spreads the debt out according to the distribution (shown as a map of the neighboring pixels)
All these "tricks" together, combined with a human's tendency to rationalize observations ("X must've happened because of Y"), can make for something that seems alive. :)
It's also quite mesmerizing to watch the relationships between the different numbers (e.g., the alertness value fluctuates, causing energy to either fall slowly or rise quickly), and all these layers add to the apparent complexity.