Effective Life Modeling Techniques

After reading quite a few articles about artificial life (a topic that I find very interesting) along with a few questions right here on SO, I started playing with the idea of ​​developing a (very, very, very) simple simulator. Graphics are not required, even. If I missed a question, please feel free to tell me.

As I said, this is unlikely to be a Sims level simulation. I think that he will hardly reach the level of “acceptable free”, it’s just a training exercise and something to maintain his skills during the break. The basic premise is that a common person is created. There is no name, height or anything like that (as I said, simply), the only real thing that he will get is a list of “associations” and common opportunities to “use”, “pick up” and “watch”.

My first question relates to associations. What does SO recommend as an effective way to deal with such things? I was thinking about a multimap, and the relatively easy key setting was what she wanted (food, food, rest, etc.), and the other part (sorry, my mind has already expired) is that it is associated with this need.

For example, let's say we have a refrigerator. The refrigerator contains food (just a common base). Initially, a person does not associate a refrigerator with food, but he associates food with hunger. Therefore, when hunger rises, it begins to arbitrarily search for food. If food is not within reach, it “uses” items to search for food. Since he does not know the association with food, he uses things willingly (perhaps looking for the nearest object and expanding). When he uses / opens the refrigerator, he sees the food, making the connection (read: insert the pair “food, refrigerator”) that the refrigerator contains food.

Now I understand that it will be much harder than it sounds, and I am ready to pull it out. The question is, will a multimap be suitable for an (possibly) exponentially expanding list of associations? If not, what would it be?

The second question I probably have a lot easier. Simply put, would a universal object / element interface be appropriate for most elements? In other words, will a common “use interface” be used for what I intend to? I don’t think I’ll explain it well.

In any case, any comments are welcome.

+3
source share
4 answers

If you are doing this as a solid-core project, I would suggest using the Java reflection equivalent (replace your chosen language). If you want to make a toy project as a starting effort, I would suggest at least scrolling through your own simple version of reflection in accordance with the following rationale.

Each artifact in your environment offers certain features. A simple model of this fact is to ask which “verbs” apply to each object that your virtual character encounters (including a possible dependence on the current state of this object). For example, your character may “open” a refrigerator, a box of grain, or a book, provided that each of them is in a “closed” state. When the book opens, your character can read or close it. When the refrigerator opens, your character can “peek” into it to get a list of visible contents, can remove an object from it, put an object in it, etc.

The fact is that a typical situation can lead your character to look around to see what is visible, requesting an object to determine its current state or what can be done with it (for example, “what-state” and “what-can - i-do "- these are common verbs applicable to all objects), and then use the knowledge about its current state, the state of the object and the list of verbs for this object to try to do different things.

By introducing a set of positive and negative reviews, over time, your character can "learn" under what circumstances he should or should not participate in different behaviors. (Obviously, you could make this simulator interactive by asking the user to participate in providing feedback.)

Above all, this is a sketch, but perhaps it can give you interesting ideas for the game. Have some fun !; -)

+2
source

To the first question:

I understand that you have a one-to-many relationship. So yes, it seems to me that it seems to me that a multi-brand card suits me.

In the second question:

Yes, I believe that a common interface for objects is appropriate. Perhaps use something similar to REST to control the state of an object.

+1
source

I heard a podcast a while ago with the developer of The Noble Ape Simulation , which may be of interest to you - conceptually and possibly code, as you can access the source code as well as download binary files .

The podcast was FLOSS Weekly 31 with Randall Schwartz and Leo Laporte.

+1
source

Life with lisp (sbcl) :)

-one
source

All Articles