Log 23/04/2012

Each organism in ReptileX is stored in a node of a linked list each node has aplace number but as the nodes are deleted and relinked when organisms die these change. Mainly for debugging purposes a number was needed which could be used to uniquely identify each organism. Soi each organism was given a model number which was stored in the node and the reptile class itself. This number is assigned when the reptile is first made and then not changed.

Now the reptiles were mating and having babys, up to this point all of the behaviours had been implemented separately and tested in isolation. In Log 30/03/2012   it was stated that a good way to simulate the biological process would be to give the reptiles a set of rules controlled by logical operators. Fig 1 shows a plan for an algorithm which would control this the basic logic is that the reptiles chooses a behaviour to perform in order of importance to the organisms survival so it is most important that the reptile eats, the next most important is keeping warm etc.


So a behaviours function had to be written which implemented this algorithm using if statements to choose which behaviour function to call. So firstly a boolean called hungry was set to become true once the reptiles stored energy was too low. But when forage was turned back on there was a problem, the reptiles would after some time had passed all start to go to eat a plant which as not there and then get stuck after a while more and more reptiles would do a similar thing and all start dying. This problem is ongoing but as it does not stop the program running it is still partially testable.

Next the boolean called cold which was turned on and off depending ton the reptiles body temperature was used so the reptile would check, if it was not hungry, if it was cold . and then it would call the bask function if it was. The problem mentioned in the previous post  where making the body temperature affect the reptiles speed had slowed them to a halt was solved. what had been happening was the speed was being multiplied by say 0.7 every frame that there body temperature was below a certain amount :

speed *= 0.7

using *=  like ++ will make the variable, in this case speed, equal itself multiplied by 0.7 each frame so the value of speed will slowly decrease bringing speed closer and closer to 0 and therefore slowing the reptiles down to a halt. The solution for this is to keep the speed the reptile has as an attribute in a variable which remains unchanged and if a new speed is needed it is always calculated like this:

newSpeed = speed * 0.7

so speed never decreases.

The next task is to get all the behaviours properly working together and fix any problems.


About evolvegold

I am a third year student doing Creative computing at Goldsmiths college University of London. View all posts by evolvegold

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: