

Ask HN: What's the coolest computer simulation you can think of? - cool-RR

Hello everyone.<p>I'm working on an open-source project called GarlicSim (http://garlicsim.com), which is a Pythonic framework for working with simulations. I've been working on it for about 6 months, and it's progressing, but what I want to have now is a nice example of a simulation to implement with it. I'm free to choose pretty much anything I want. It can be a simulation of physical solid bodies interacting with each other (like maybe a solar system), or of a road system with traffic lights and cars driving through it, or anything else.<p>So I figured I might ask here and get some nice ideas. Do you have any?
======
frig
Zombie invasion.

Basic rules:

\-- VISION:

\- noninfected can see agents within radius R but can only determine if a seen
agent is "zombie / not zombie" within radius r < R

\- infected can see agents within radius Z (r < Z < R) and can make "zombie /
not zombie" determination instantly

\-- VISUAL PERCEPTION:

\- both agent types perceive (1) the position of other agents within their
field of view and (2) the orientation of those agents (3) the current movement
of the agent (movement vector + rotation)

\-- SMELL:

\- noninfected and infected leave (distinct) scent trails; over time these
trails both (1) diffuse and (2) diminish in intensity (say: exponential with a
cutoff below which you round to zero)

\- noninfected agents have a cutoff N below which they can't smell infected
scent

\- infected agents have no such cutoff

\-- NONINFECTED COMMUNICATION:

\- noninfected can communicate about zombie locations in relative terms over a
distance C > the visual cutoff. The contents of the message have the form of a
list of agents (positions, orientations) _relative to_ the sender's position
("zombie five meters to my 7 o clock, facing my 3 o clock"). The
communications are tagged with two fields: a relative position (direction and
distance relative to agent's current position) and the communicator identity.

\- position rules: if communicating agent is in visual range then relative
position is exact; if communicating agent is out of visual range than relative
position is a range (22 to 57 degrees), (50-60 meters)

\- identification rules: if communicating agent is "known" to receiving agent
then receiving agent gets the message tagged with communicating agent's
identity. If the communicating agent is not known to receiving agent then the
message is tagged "unknown" if it originates outside of visual range and with
the communicating agent's identity if it originates within visual range.

\- knowing rules: an agent becomes known to another agent if the agent
communicates to the other agent within visual range (eg: if you talk to me
when I can see you I know your voice now)

\-- INFECTION RULES:

\- all agents have a variable tracking the amount of zombie toxin in their
bloodstream; this ranges from 0 to 100.

\- a noninfected agent becomes infected when they cross the '50' level of
zombie toxin. At the moment of infection they instantly shoot up to '100'
zombie toxin.

\- a noninfected agent loses zombie toxin @ a linear rate (with floor @ 0)

\- an infected agent loses zombie toxin @ a slow-ish exponential decay; it
should take them awhile to decay from

\- an infected agent becomes uninfected when they cross the '25' level of
zombie toxin.

\-- MOVEMENT RULES:

\- noninfected agents move more quickly than infected agents

\- all agents have a finite maximum turning speed

\- noninfected agents move progressively slower the more zombie toxin they
have (eg: base speed - (penalty x (ZombieToxin/100))

\- infected agents move progressively slower the less zombie toxin they have
(eg: base speed + (booster x (ZombieToxin/100))

\-- INFECTED BEHAVIOR:

\- infected are understood as trying to produce more infected.

\- INFECTING: infected who are within some infection radius of a noninfected
agent for > some minimum # of timesteps begin to infect the agent with zombie
toxin at some rate (perhaps: higher rate the more zombie toxin there is); the
agent doing the infecting also gets increased zombie toxin at some fractional
rate (eg: if an infected agent adds Z zombie toxin to an noninfected agent's
bloodstream then the infected agent gets .7 * Z zombie toxin, also). The
infected agen ThInfection "stacks" on agents.

\- INFECTING: infection (zombie toxin increasing) stacks on the receiving
agent; "multiple zombies can attack the same survivor at the same time"

\- INFECTING: zombies can't attack multiple agents at the same time; "a zombie
can only be biting one survivor at a time"

\- HUNTING: zombies are either "hunting" or "wandering". A zombie "wanders"
(random walk) when it isn't doing anything else. A zombie can determine if
some other zombie in its field of vision is hunting or wandering.

\- HUNTING, LOWEST PRIORITY: if a zombie sees a sufficiently strong and
unambiguous zombie scent trail it will go into "hunting" mode and follow the
trail until it thins out

\- HUNTING, NEXT LOWEST PRIORITY: if a zombie sees a sufficiently strong and
unambiguous noninfected scent trail it will go into "hunting" mode and follow
the trail until it thins out

\- HUNTING, NEXT LOWEST PRIORITY: if a zombie sees other "hunting" zombies it
starts chasing the nearest "hunting" zombie

\- HUNTING, HIGHEST PRIORITY: if a zombie sees noninfected agent it
immediately begins chasing the agent

\- WANDERING: a zombie returns to wandering mode when none of the above
conditions trigger

\-- SURVIVOR BEHAVIOR:

\- I'd make this pluggable (and then the fun really begins!) but the general
behavior is to try to avoid getting infected, presumably by avoiding contact
with zombies (break incoming zombie hordes into clusters with similar movement
vectors; project movement vectors forward in time; aim to be elsewhere)

\-- MAP:

\- some tile-based system with walls and open spaces is a good starting point

~~~
frig
I forgot a couple other points.

A noninfected can see a zombie and recognize that it is the zombified version
of some "known" agent.

There's two goals with the communication:

\- the first is that it opens up a lot of fun if you have pluggable behavior
for noninfected (EG: LIARS!)

\- the second is that it forces you to deal with interval arithmetic (or an
equivalent scheme)

~~~
cool-RR
This is one comprehensive description you gave here. But the problem is, it
looks like a simulation that will be more enjoyable to the programmer than to
the person watching it. After all, it would just look like dots moving around
changing color.

Additionally, I'm looking for something that besides being cool, will be sort
of useful.

~~~
frig
Eh I can tell you that variations on the above scenario are actually useful.

There's a handful of companies that essentially do more in-depth versions of
these things at like the level of "h1n1 comes to small town america; what
emergent behavior patterns do we see in our model" (names escaping me sorry).

There's also a lot of boring-ish economics sims that've been done (names
escaping me also, sorry).

To make it fun for the end-user you'd have to "borrow" tilesets from a
videogame I think.

You're right though: it's more fun for the person making it than a casual
observer.

------
cool-RR
I've reposted this: <http://news.ycombinator.com/item?id=827071>

