Welcome to The Journal of a Demiurge.
What is this?
Saturday, May 15, 2004, 12:36pm CST
Biots 2.5
It works on Mac OS X now!
It has
SNAKES! Snakes special abilities are that it moves 15 insteal of 10 pixels when it side-steps or goes backwards (like a sidewinder, get it?), and when snakes crawl, they can go under or over rocks! Snakes only go 20 pixels when they run, instead of the normal 30. But they still go the normal 60 when they jump!
Other changes, Apple trees now gain 20 energy in spring, and 10 in fall (these are bonuses to offset the apple's long germination period) Cherry trees have had their Maxiumum Age increased from 750 to 1000 turns. Fungi have had their reduced from 750 to 500 turns (actually a bunos for fungi, because they only reproduce when their max age is up) Mice and Rabbits have been weakened to only having 90 strength instead of 100.
Menu Tweaks: Now you can turn off speciation, this means that trees will only ever produce the right kind of fruit, and biots will only ever produce more of the same species. This is good if you're running an expiriment and you don't want unpredictable interference.
Also you can completely turn off the pause time thing when you select "speed up applet" This is just to test to see how super fast processors will deal with biots. The default still starts you out with a slight pause, to keep things going at a steady pace.
Wednesday, April 21, 2004, 12:30pm CST
Biots
Version 2.3 already!
So many changes. Biots Change List Go!
All energy numbers involving trees have been multiplied by five. They gain 15 energy in spring, 10 in summer, 5 in fall. Pine trees now gain 10 all year round. Apple and Pine trees spawn fruit when they get to 1500 energy, dropping them down to 500. Cherry trees make cherries when they get to 1000 energy. This makes leaf eating a bit more useful for the biots. Biots can only eat leaves off of trees if the tree has at least 500 energy. Also, saplings turn into adult trees the first time they gain 500 energy. Also, biots can strafe or retreat through trees that don't have leaves or needles (such as saplings, or banana, cherry, and apple trees during the winter, and banana trees during the fall) They also aren't slowed by these trees when moveing or running. Now only "heavy brush" (that is pine trees, and trees currently have leaves) restrict the biots' movement in this way.
I introduced two new plants! Banana Trees and Grass! Banana trees make Bananas when they reach 1500 energy. Bananas gain 100 energy per turn like the other fruit. Their maximum energy level is 2500, and they last for 75 turns. Banana trees gain 15 energy in spring, but they actually gain 20 in summer. See, they're specially adapted to the summer temperatures. To offset this, they gain no energy in fall as well as winter. Their leaves can't be eaten in fall, but bananas can sprout saplings in the fall. The maximum age of the pine cones is now 125 so they can reproduce a little faster.
Grass gains energy the same way that apple and cherry trees do, but instead of having to bother with fruit, grass just makes a copy of itself. When it gets to 1000 energy, it uses 500 to try and sprout a new patch of grass. It randomly chooses one of eight directions and tries to put grass there. Grass can be placed on fungi or rocks, unlike saplings, but it can not be placed on top of another patch of grass or on a tree. If the grass tries to sprout on top of another patch of grass, it instead donates its energy to that patch. This makes a big group of grass like a single organism, spreading energy out to the edges to find a place to grow. If it finds a tree in its way when sprouting, the grass just keeps its energy and tries a different direction the next turn. Grass is also immune to fungal rot. Grass gains no energy in winter, and it also becomes invisible (I use a blank transparent gif to represent it). Grass can't be eaten during winter, but it can still pass energy around if some of the patches have 1000 energy or more. Grass has three main weaknesses though, it only lives for 500 turns, it can't grow under a tree, but trees can grow over it, eventually choking it out, and when a biot eats grass, the grass dies. It can't grow leaves back like the trees. Grass also counts as "food" in the biots memome.
Not only has grass been added to food, but there are also two new generalizations for the biots to look for in their memes. The first is leafy, this refers to any plant that currently has edible leaves. This is a more useful generalization than tree because it doesn't refer to pine trees, saplings, trees with less than 500 energy, banana trees during fall, or anything during winter. Just grass and trees with edible leaves. Like the fruit generalization, a penalty of 100 energy is taken when a biot uses the "eat leafy" action instead of trying to eat the specific object type.
The other generalization is protein. This refers to meat, eggs, and fungi. I don't think real fungi are protein rich, but I thought I'd cram them into the category. Like the fruit and leafy generalizations, a penalty of 100 energy is taken when a biot uses the "eat leafy" action instead of trying to eat the specific object type. Fungi are not considered poisonous when eaten in this way, unlike using the food generalization.
Now when new biots are created randomly, their cheat gives them three starting memes. The first tells it to always try to reproduce, it randomly chooses one of the three means of reproduction. The second meme has it pick one edible object to always try to eat (though the "tree" category is used here instead of picking one of the three edible trees to try to eat. the "tree" generalization doesn't have an energy penalty associated with it.). The third meme has it pick one general category to always try to eat (food, fruit, leafy, or protein). I played with the way new memes are picked during mutations as well. When selecting an object to be associated with a condition or action, the mutation algorithm picks a random generalization (biot, friend, foe, tree, food, fruit, leafy, or protein) 3 out of 5 times, a biot species 1 out of 5 times, and a specific object 1 out of five times. This is because I keep adding new objects to biots, and most new memes refer to something that doesn't come up in the environment that often, contributing to useless junk memes. I still have the problem of there being actually less evolution of simple things like finding food by feeling for it than when biots was a simpler program. I don't want to cheat to make evolution too easy, but I'd like to find something that doesn't make it so hard. I should probably also mention here, if I didn't already that using generalizations for "biot", "friend" or "foe" decrease the amount of damage done when attacking. A minus 50 damage penalty for attacking or pushing a "biot". Minus 25 attacking or pushing a "friend" or "foe", or for grabbing a "biot", and minus 10 for grabbing a "friend" or "foe".
New Biot Species! The newt It looks like a gila, with feet like the frog and a slightly different head and tail shape. They are also colored like the fungi.
New option in the options menu! Change Climate You can toggle between Temperate, Tropical and Artic climates. Temperate climate is the normal default. 250 turns for each of the four seasons. If the climate is tropical, you get 500 turns of spring, followed by 500 turns of summer, then back to spring again. If the climate is arctic, you get 750 turns of winter, followed by just 250 turns of fall. There is a display that'll tell you what you're switching too, and if you turn any of the tag modes on you can see the season and time all the time.
Getting down to the end of the changes, and now here's the most major change of all. Now each biot species carries a speacial ability, advantage or disadvantage! That's right, finally the different species actually interact with the environment differently. This is to encourage each species to adapt in a certain slightly different way. The different abilities of each of the nine biot species is as follows
Frogs use the same amount of energy for jumping as they do running (45e) they also only use 1e when relaxing. This reflects the fact that the frog's legs are specially adapted to lots of jumping, and they have the ability to slow down their metabolism to hibernate.
Newts have poisonous meat and eggs. Why else would they be colored like the fungi? Newt meat starts with 0e and drops down to the negative energy value that the newt had when it died. Newt eggs have -1000e. Of course biots can use "eat protein" to get around this poison. Newts also only need 8500e to reproduce asexually (burns 500e, gives 4000e to each child), and at least 3250e to lay one egg (saves 2000e for itself, burns 250e for each egg laid, gives 1000e to each egg. (actually -1000 because it's poisonous but hatchlings are born with 1000e). All the other biots burn 1000e in asexual reproduction and 500e for each egg laid.
Gilas stun biots for 5 turns when they push them. Stunned biots burn no energy, but they age normally and can't perform any actions. Gilas could use this ability to help them hunt. Gilas also have a strenght of 110 instead of the normal 100. This means they do 220 damage when attacking or pushing (not counting generalization penalties) and 110 damage when grabbing. It also means that they can't be grabbed by weaker biots. They get to move as normal, though the grab attempt will still injure them.
Turtles have been altered the most. First of all, their hard shells let them take only 1/4 the regular amount of damage when they are injured. They also get a bonus of 500 extra turns to their maximum age. This makes turtles difficult to hunt. To balance this, all of the turtle's movement speeds have been reduced. It crawls, strafes and retreats at 5 pixels, moves at 10, runs at 20 and jumps at 40, as opposed to the 10, 15, 30, 60 speeds of most other biots. It burns only 5e for crawling and 15e when moving, but uses 50 for running and 105 for jumping, as opposed the 10, 20, 45, and 95 units burned by the other biot species. That protective shell is heavy!
Emus aren't slowed down when walking or running through heavy brush (leafy or needly trees). They still can't strafe or retreat through brush.
Mice have a super digestive system. They suffer no generalization penatlies when eating! They can use the food, fruit, leafy, and protein generalizations and still get all the energy their food has to offer. This is especially useful if there are a lot of pine trees, because using "eat food" on a pine cone only gives most biots 200e, and only 300e if they use "eat fruit". Mice don't get specialization bonuses for using "eat green apple" or "eat rotton apple" though. This shouldn't be a big deal, I doubt many biots use this at all. Mice still suffer strength penalties when attacking, grabbing, or pushing and using a generaliztion.
Rabbits are fast! The go 20 pixels for normal movement, 40 for running and 80 for jumping. As opposed to the normal 15, 30, 60 speeds of most other biots. Rabbits still go 10 pixels when they crawl, just like other biots. Rabbits don't have to burn any more energy for this movement bonus either! They are built for efficient speed.
Foxes are the strongest of all biots! With a strength of 125 they do 250 damage when they attack or push, and 125 damage when the grab (of course, this doesn't include generalization penalties). Their super strength also means that they can only be grabbed by other foxes!.
Cats are good hunters. They do as much damage when they grab a biot as they do with an attack or push. They also have a strength of 105. This means that they do 210 damage when they grab, attack, or push another biot. In addition, they suffer no generalization penalty when they grab. They still suffer normal penalies for attack and push. Another helpful hunting ability is good eyesight. Cats can see 150 pixels away instead of the normal 100 pixels of the other biots. The cat's strength level also means that it can only be grabbed by cats, gilas, and foxes.
I've updated the
Biots Info Page with all this information stuff too.
Wednesday, April 14, 2004, 4:00am CST
New addition to
Biots 2.0!
Defoliate!
Instead of chewing the trees until they die when a biots tries to "eat" or "grab" a tree,
now it takes away the trees energy, and strips it of its leaves.
This only works on trees with 100 or more energy, and doesn't work on pine trees.
It also doesn't work in the winter.
Biots specifying apple or cherry tree get all the trees energy. Biots generally trying to eat a tree
get 10 less units of energy (reflecting a less specialized digestive system)
Now any tree with less than 100 energy looks like it does in the winter! also saplings turn into adult trees as soon as a new tree gains 100 energy.
In the new biomes memome cheat, they now sometimes will choose to eat leaves. I also made eating "food" 3 times as likely as most of the other choices and eating "fruit" twice as likely.
Also rocks and pine trees can no longer be attacked or grabbed! I may change them later to allow attacks but have them damage the biot. In fact, now only Biots can be grabbed. If a biot tries to grab something edible, it will eat it instead.
A long-ass time ago I did the thing with shortening the action strings. They are indeed only six characters long. 3 for the action type and 3 for what object to be affected. The conditions are seven characters long. One acts like a sign bit (even though it's a char) three for the condition, and three for an object.
I think biots broke under OS X because of the getting parameters from the web page thing. Maybe. Anyway I'm going to work on fixing that.
Also, saving the biome outputs the html formatting biot information to the java console. You can open up the java console (if you have it enabled) and paste it in an html file and view it in a web browser. If you have the biot images in the same folder as the file, you can see the images that the biot was using too. (this is mainly for me). Maybe I can output this string to a text box that people can copy and paste into a text file, then paste back in to load the environment. Some day we'll have savable biots. Some day.
Wednesday, January 7th, 2004 7:17 pm CST
Biots now can have
branching programs! I did this by creating two new mental actions,
if and
else if. They are interpreted just like if and else statements in programming languages. You can even have if-else-if statements inside other if-else-if blocks and it works like it should! Some of the code I came up with to do this is functional (as opposed to iterative) like ML. I'm glad I took Programming Language Concepts in college or I wouldn't have figured out how to do it so quickly.
Wednesday, January 7th, 2004 1:55 pm CST
I changed how biots reads and creates the code for conditions in the memome last night. Not it's a lot fewer lines of code and it's a lot easier to add new coditions or objects. I'll do the same for actions soon, probably. Right now each condition is a string of 10 letters, though this morning I realized I could and should cut that down to 7. The string for the actions will likely be 6 letters long. Now if I could only get the java talking to javascript thing working again I could probably fit a saved state into a 4k cookie!
I think it stopped working because I updated Mozilla. I need to find that plug-in again.
Monday, January 5th, 2004 2:48am CST
(2 days after NASA lands another rover on Mars. Yay!)
Biots version
1.8
I haven't updated in a very very very long time. Mostly because I had a job or something, but I have been working on biots for pretty much the entire month of December
(at the begining of which I quit my job). Let's go through the changes, shall we? First off, I added different seasons to Biots! These seasons only affect the environment
when manna mode is off. Manna mode is now no longer the default mode because I've decided that the trees reproducing is more true to my vision of Biots. The four seasons are
obviously spring, summer, autumn, and winter. I also added new kinds of trees with new kinds of fruit.
Now there are cherry trees and pine trees. Cherry trees drop cherries and pine trees drop pine cones. And I tweaked how trees produce fruit to reflect the differences in the
different species of plants. Trees gain energy each turn until they reach a certain amount, then they lose some of that energy to produce fruit. Apple and Pine trees must wait
until they have 300 energy, then they spend 200 of that energy to produce an apple or a pine cone. this means that the first time the tree bares fruit it takes a little longer than
the others. Cherry trees must gain 200 energy, but then only spend 100 to bare a cherry. This means that generally cherries are produced at twice the rate of apples and pine cones.
Cherries also only take 50 turns to sprout into a new cherry tree, as opposed to the apples 100 and the pine cones 150 turns. Cherries start at 0 energy and gain 100 every turn until
they reach 1500, they lose 100 energy for the last 15 turns of their lives. Apples are similar, but they reach 3000 energy. Pine cones start at 500 energy and never lose or gain any.
The trees reproduction and graphics are affected by the seasons. In spring the ground is bright green, just as it always has been in Biots. The apple trees each have five white flowers
and the cherry trees are pink with little white flowers. In summer the ground is a slightly darker green, to match the green apples and frogs, the apple trees look like they normally do
and the cherry trees are a light green (the same green as the ground in spring) In fall the ground is brown and the apple trees are either yellow, orange, or red, depending on how old they are. The cherry trees
are either purple or maroon, depending on how purple they are. The pine trees all look the same during these three seasons. In winter the apple and cherry trees have no leaves. The ground is white and there
is a little snow on the pine trees. In spring the apple and cherry trees each gain 3 energy per turn, in summer they gain 2, in fall they gain 1 and in winter they gain no energy. Winter also prevents
rotting apples and cherries from sprouting, they simply rot away. Pine trees hand all the seasons the same. They always gain 2 energy per turn, no matter what season, and pine cones can sprout
in winter. Turning manna mode on in the menu will cause it to become summer(except with the ground color from spring), and the seasons will not change.
Adding fruit via the menu will randomly choose which fruits to add. If Manna is on, this won't inclue pine cones.
Biots can not as of yet tell one kind of tree from another, nor can they tell any of the 3 types of fruit apart. I will probably change that in the future.
The biots do, however, have 10 new conditions available! All based on the ability to sense the seasons! They can tell if it is
spring,
summer,
autumn, or
winter,
and also have a
not condition for each. They can also tell if it is
hot which is true during spring and summer, and
cold which is true during fall and winter.
I may also add a "wet" for winter and spring and a "dry" for summer and fall. I don't know if that would be useful.
Successful survival strategies with the seasons added include hibernating during winter, not reproducing when it is cold, and cannibalizing during winter.
I'm going to update the biots main page so that it no longer loads the applet right away, just links to a spot where you run it.
I finally added
and and
skip actions. These were very difficult to do because I had to modify the main step code in the biot class. I had to change
very little in from my pseudo code, though. I wrote it on a notebook in the car on the way to Rhinelander! Basically
skip looks at it's corresponding condition, if it is
true it skips the meme directly below it, if it's false it just defers to the next meme.
and is similar in practice, but it skips if the condition is not true, and doesn't skip if
it is. I think I'll add and action called "flip" which will just reverse direction in one move, but use lots of energy.
I modified the
full condition so that it takes into consideration how the biot was born. 1000 energy+the cost of reproduction is now the threshold of fullness.
I'm working on adding a new
turtle species. So far the sprites are 1/2 done, but 1/2 of those need to be improved. I changed the color of the fungus sprites from brown with yellow
spots to purple with red spots. It fits the other sprites better now.
I have new programs for the menu added herbivores and omnivores. The herbivores only reproduce when it's hot, the push their own eggs to force them to hatch.
(I modified push so that it took 200 energy away from the eggs when it did this, making the hatchlings have only 800 energy to start with) They seek food with vision and hibernate in winter.
The omnivores reproduce when it's warm, seek food, prey and, when it's warm, mates, using vision, and hibernate in winter.
The herbivores are also now emus and not rabbits. It was too wierd seeing rabbits lay eggs.
I added 4 types of tags to biots. Type 1 shows the index just like it used to, 2 shows energy 3 shows age over maxage and 4 shows the vision triangles. This can be cycles
through the hideous option menu that I never got around to changing.
Also, now when the biome array is full, it increased only by 50% instead of 100% this should help my poor low-RAM machine.
I also noticed that java can no longer talk to javascript. Likely because I downloaded a new version of Mozilla. Interestingly enough Biots works on IE on XP now, but doesn't work
for any browser on Mac OS X! It still seems to work on an emulated OS 9 version of Moz, though. I need to download whatever it was that let Java talk to JS again. I decided I
wanted to create the code for compressed save files, but now I can't get the cookies to work! I went through the newCondition code in Memome and made it so it built the strings
using the + operator. This made the code much shorter, but for some reason the Biot class didn't recognize it. Even thought the output showed it was identical! So I put it back the way it was.
I think it may soon be time to use vectors instead of strings to do the conditions and actions. This should make code shorter and make it easier to
add new stuff. I know building the strings didn't work!
Sunday, September 28th, 2003 10:22pm CST
Okay some changes in Biots for version
1.7
I've separated the toggles for Genetic drift and Apples-from-heaven VS growing trees into two different menu items.
The latter is called "Toggle Manna" in the menu.
I increased the life span of the fungi to 750 turns, effectively decreasing their
reproduction rate. This keeps the fungi from wiping out entire forests, that and the fact that fungi only consume trees now and not fruit or meat.
The longer lived fungi also makes biot more likely to evolve the ability to differentiate between fungi and fruit.
One of the major new additions is a third means of reproduction,
egg-laying. Egg-laying works just like sexual reproduction,
only it requires only 1500 energy to lay each egg, and each new biot has only 1000 energy to start with. And of course, eggs can be eaten by other biots,
or even the mother. I may modify this to only take 1000
energy to lay each egg with 500 energy taken off the top for the sexual act. It took a while to find a good balance with the eggs and energy, at first
the eggs slowly grew from having 1000 to 4000 energy, then hatching, but this created positive feedback loops that made the population explode and completely
eroding natural selection. Eggs can now be sensed as part of
food, and can also be sensed as
eggs.
Trees no longer spontaneously give birth to frogs, instead they occasionally lay a frog egg instead of an apple. The egg is even laid near the tree that
spawned it.
The other major addition was to the biots senses. I haven't added a new sense, but have allowed some senses to pertain to larger categories.
The Touch and Vision senses can now apply to three new object groups.
Biot, refers to all biots, obviously,
friend refers to biots of the
same species, and
foe refers to biots of different species. I think this should allow for the development of more sophisticated hunting and
breeding strategies. Although it still seems to be the case that sexual replication evolves away and stable pred/prey relationships never emerge.
I also made the likelihood of speciation be 1 in 25 instead of 1 in 20. Making it even less likely may be a good idea.
Sadly, no progress has been made on allowing saved environments.
Thursday, August 14th, 2003 12:30am CST
I shouldn't have spent last weekend working on biots at all, but I got the inspiration, so I went with it. Here are the few changes.
Genetic drift now only creates 21 (3 of each species) biots instead of 35. Adding 35 biots was creating too much instability. Ideally genetic drift should be very subtle. Perhaps even more subtle than 21 newcomers, even if most of them are complete maroons. The initialization code now calls the drift method twice, resulting in 42 new biots at the very beginning. Big drift is necessary when the population is zero =).
I finally fixed the bug that had biots sleeping while moving as they ran through forests. I think I forgot to mention in any update that now biots can move through trees as long as they crawl, move, run, or jump. But moving through trees uses the same amount of energy of a normal move, but only goes the distance of a crawl, and running through trees uses the energy of a run, but goes the distance of a move. Regular crawl and jump rules apply in forests. The idea is that biots waste energy trying to move too quickly through rough terrain, they should learn to slow down or jump over. They still cannot retreat through or strafe through the woods. The idea being they need to be a little smarter on how to use their bodies when they go through the thick underbrush.
Now when a biot eats a rotten fruit and dies of starvation or old age, it becomes a new tree. It used to just be old age, but the trees have a tough enough time reproducing when the biots start eating all the fruit. I think it that I'll change it so that death by old age no longer yields a tree in a seeded biot, because it's not as fair to a predator who spent all that time hunting a biot, only to have it become inedible!
I made new graphics for the trees. There's a sapling sprite, which appears for the first 90 turns of a tree's life, and a dead wood sprite which appears for a turn when a tree dies. Eventually I'll make the dead wood stick around until consumed by a fungus. And I'll make the different stages of a tree distinguishable to the biots' senses.
I did an apple-blossom tree graphic, to show when trees are about to fruit, but haven't used it yet. I also made sprites for eggs, but haven't implemented egg-laying yet. That will be so cool, I predict. The idea will be that a biot needs a lot less energy to lay an egg than it would to have live young, but the eggs are edible, so many will likely not ever hatch. I think I'll try to develop some actions that would allow biots to protect their eggs too =) Probably a carry that could also be used to carry an apple around until it was hungry, or carry a poisonous fungus around to discourage predation.
Another thing I did was almost certainly temporary. I created a few menu options that add some pre-programmed biots of my own. One is an herbivorous rabbit that is extremely good at finding fruit. Another is a gila monster that is good at finding all kinds of food, but pushes fungi away instead of eating it. (an adaptation I've witnessed occurs naturally) and the third is a fox that is very very good at hunting rabbits, but eats nothing else. It's amazing to watch. The little fox actually chases after the rabbits, turns to follow it, runs to catch up, and grabs it to pull it close as it attacks. It doesn't catch all the rabbits it tries to, (which is more natural and balanced) but it's like watching a nature show. (a low-res, low-framerate nature show) The ecosystem doesn't stay balanced for too long though. The rabbits usually are too good at finding food, so the trees don't reproduce, and the foxes tend to either eat all the rabbits, or the rabbits adapt by jumping all over so they don't get caught. Either way the system collapses. I'm going to add distinctions for biot, friend, and foe to the feel and see senses, so that a predator can hunt all the biots that are not like it, even if the prey speciates, and maybe it will make it more likely for some sequences to evolve that have biots of the same species seek each other out for mating.
I've also finally found a way to let Java talk to Javascript. So I have code that saves the whole environment to a string that it sencs to javascriot which saves it as a cookie. The problem is that cookies cannot exceed 4k so I need to compress the save file format a whole lot.
The way it is now still lets me glimpse at a developing biot's memome. The other night I awoke to find that the funny acting rabbits that I'd left on all night had a memome of length SIXTY-ONE! The length starts out at TEN! To encourage complexity there are two ways for the length to increase and only one for it to decrease when mutations occur, but there needed to be something to discourage complexity without significant gain in intelligence. So I altered the code that determines the biots starting Maximum Age from MAXAGE = 1000, to MAXAGE=(memome.getLength() - 10)*10 which means that a biot with a memome length of 10 can live to be 1000 turns old, length 11 means it only lives to be 990. memome length 31 would only allow a biot to live to be 490 turns. Which might be enough if those 61 memes make the biot so smart it has a bunch of kids before it dies. On the other hand, if the length is only 9, the biot lives to be 1010. If it had no memes at all, it could live to be 1100, but good luck reproducing!
Anyway, that's what's going on in the land where the ground is always 00FF00.
Saturday May 10, 2003 8:41pm CST
A few days ago I fixed a bug that was preventing biots from turning into meat when they were attacked.
That explains why I was having a problem getting them to eat each other! I also increased the biots'
strength to 100 instead of 30. It takes much fewer attacks to kill prey now, but still more than back
when they ate prey in one gulp.
I had another idea for an addition. To go along with the cyclical sense of time I plan on giving the biots
I should introduce four different seasons, with different rates of food production and possibly even different
background colors! That might even select for hibernation behavior! Wouldn't that be neat?
It sure would be nice if I would get around to converting the whole thing from an applet to an application
so I could save and load environments.
Friday May 2, 2003 12:43pm CST
Biots 1.4 now exists
I was killing time between classes, looking at a
simulation of emergent ant behavior,
when a fellow student asked me what I was
looking at. We got to talking about ALife, AI, and emergence. I showed him Biots and he showed me a website with examples of
steering behaviors for autonomous characters. He was working on an independent study that
incorporated some of those behaviors into characters with an artificial neural network they would use to learn how to adapt to a 3D
environment. His work isn't done, so I don't have a link to it.
While I was talking to him I realized out loud that I could
make the biots adapt faster if I increased their rate of mutation as a function of age. So that's what I did, biots start out
with a 1 in 10 chance giving birth to a mutant, just like they did before, but now the chance increases by 1 every 100 turns.
If they breed close to the end of their life, they will almost certainly produce a mutant. It might be a better feedback system
if a biot's mutation rate is increased as the population increases and decreased as it dwindled. That would ensure a stable population
and encourage trying new survival strategies when the food sources become strained. Mutation increasing with age can actually produce
the opposite effect. The problem with that is that I never could accurately count the population for some reason, and in the version
with increased mutations I finally took out the population count altogether. I will rely on a periodic census if I ever end up
making a population graph option. The miscounting was really messing up the long-term runs of biots because it would add 35 biots to a
world it thought was empty when there were actually plenty of biots around. Periodic genetic drift is good, but if the periods are too
short it becomes a strain on the environment. The only potential problem now is if a mass extinction occurs for real, the environment may have to
wait a long time for drift to reintroduce biots. Perhaps drift should occur slightly more often, with drastically fewer individuals.
That might be more realistic anyway.
Now, on to the major changes. These changes may be temporary, depending on how well they end up working. These changes only apply to a new
"mode" of biots, which for now is activated by turning off genetic drift.
I always wanted biots to get more and more complex as I wrote it. One of the things I've always thought of adding was a more
realistic plant propagation system. Until now,
apples and
fungi would constantly be spawned at random points on the screen. Now, they
reproduce much like the biots. When an apple appears with genetic drift turned off, it has a much shorter life span. When the apple rots
it does a quick search of the biome array to see if any trees or rocks are in the way. If there are, it rots as normal, otherwise
it takes root and turns into a
tree. A tree lives for 2000 turns, twice the age of a biot. Every 100 turns it drops a new green apple
in one of eight locations evenly spaced in a box around the tree. This means that forests can grow from a single apple. Apples may overlap,
but trees won't, which curbs their growth a bit. Trees act kind of like rocks, in that they are a barrier, except right now biots can
crawl
or
jump through trees, while any other method of locomotion blocks motion. I think I'll create a new action
climb that will only allow
biots to move if they are touching a tree, and make crawling blocked by trees again. That'll drive the evolution of switching locomotive behaviors when
one fails. The second way a tree can reproduce occurs when a biot eats a fruit that is rotten. When this occurs the biot becomes "seeded." A seeded biot
becomes a tree instead of meat if it dies of old age. I think I will tweak the system so that the seed disappears if a biot is attacked, so as not
to discourage predation. In fact I need to think of ways to encourage it, because it's not occurring very often. The seeding of biots is a way of
sort of simulating the real life function of fruit, to spread young plants far away from the parent so they don't compete for sunlight and space.
In addition to the trees, I've altered the way the fungi reproduce when drift is turned off. Fungi now have shorter lives, and upon their death, they
do a search through the biome array for two nearby trees, fruit, or meats. If found, they are replaced by new fungi. This creates a sort of
predator for the trees. Originally the fungus spread to all nearby foods, but I had to limit it to two because it wiped out the forests too
quickly. The fungi are still poisonous, but I think now they are rare enough that biots might not evolve away from eating them, which is kind of
unfortunate. On the other hand evolving away from fungus eating often leads to evolving away from scavenging, and now eating a fungus can save a forest
so at least your offspring and siblings may survive. We'll see how it all works out.
Finally, since there is no spawning of random biots, fungi, or fruit when drift is turned off, I introduced plant speciation. Although
since the plants turn into fungi and biots, it's really more of a kingdomiation, but this is just a simulation. There is a 1 in 100 chance that
a tree will infect 2 nearby foods with a fungus (possibly itself) instead of producing fruit, and a 1 in 100 chance that a tree
will cause a frog to spawn randomly on the screen instead of producing a fruit.
Next on the possible agenda. Increasing damage done by attacks to encourage predation and discourage laziness. Introduce the climb action.
Introduce leaf eating, which would yield low energy and keep trees from fruiting. Fill out the trees' lifecycle with sapling, adult and dead-wood
forms. Make mode-switch more obvious. Give the biots the senses needed to detect trees. Overhaul biot and memome code with string parsing to make it easier to code
new conditions and actions. Overhaul method of locating an open spot in the biome array by using a stack to store open indexes, to increase the speed of the
program.
Tuesday March 4, 2003 12:55pm CST
Biots 1.361 has another new specie. The sprites are chocobos from the Final Fantasy games, but we'll just call them
emus, okay?
Monday March 3, 2003 6:25pm CST
Biots 1.36 Has a tweaked sex metabolism, It used to cost 8000 energy for the first offspring, with each additional offspring costing 4000, and the mother wouldn't reproduce sexually without a reserve of 2000 energy after having kids. Now it always only costs 4000 energy per kid. The mother still needs a reserve of 2000 energy, but now that only means having 6000 total energy to have a kid. I changed the default memome so that a biot always tries both sexual and asexual reproduction, because now sexual reproduction takes less energy than asexual reproduction (still 8000 to split into two identical offspring). Before a biot had to wait until it was no longer a juvenile to reproduce asexually, and this led to adapting away from sex in some populations.
It also hopefully has better error and exception handling. It wasn't working on my mom's Mac in Madison because it didn't know the getWidth() and getHeight() methods existed in a standard applet. Now I catch that error if it occurs and use default dimensions.
I also updated the
biots info page with the new changes. It hadn't been updated since I added
crawl,
retreat and
strafe. Now it includes those, as well as
grab, and the new info on the metabolism rules for sex.
Wednesday February 26, 2003 12:46pm CST
I haven't tried fiddling with the sex metabolisms yet, but I did spend my free time today making sprites.
Behold!
Biots 1.351 With Gila Monsters!
Tuesday February 25, 2003 1:38pm CST
I've been running biots a bit more lately. I think I need to change the energy required for sexual reproduction. For a while I had it take as much energy to have one kid as required to split into two. This meant that asexual reproduction took precedence over sexual reproduction, because as soon as a biot had enough energy to reproduce, it would split in two, except in the unlikely case that there was another biot of the same species touching it. I fixed this in the initial memome, by not letting biots reproduce asexually until they are no longer juvenile. This lead to evolving away from sex, because waiting for a partner wasted energy that could be applied to reproducing right away. The mutants that stopped waiting for sex out produced the others. If I make having one offspring cheaper that mitosis, then sex will stick around in the genome. =)
I also think the "father" of a sexually produced biot should lose a tiny bit of energy. Maybe then I should give them a choice in if they want to father a kid...
Friday February 14, 2003 8:48pm CST
Biots 1.35 is up! Haven't updated in a long time, I know. Which is pretty ridiculous because I modified Biots when I was back in Madison over winter break. The new version has some pretty big changes in the rules of survival. No longer can one biot simply consume another. Now it has to "Attack" the other biot, this uses a little energy, and reduces the MAXAGE of the targeted biot. Constant attacking eventually gives the prey a lower MAXAGE than age, and it becomes meat, Which the predator hopefully eats. While attacking, the predator looks like a face with red eyes and huge teeth chomping. I created a few other forms of attack as well. "Pull" brings the targeted biot closer as it attacks, the other form of attack is really just the old "push" action. I may have added another, but I can't think of it right now. That's why I should update my journal right after changing the code. Another addition was the inclusion of a new sense, "pain". A biot feels pain during a turn in which it was attacked, pulled, or pushed. Far from cruel, giving them this sense will allow them to know when to escape from dangerous situations.
I was also pretty sure I had fixed the bug where the applet was miscounting the population. I have a number that appears in the environment that shows the current total population count when you turn the biot tags on. I think there still may be a problem though. To deal with the possibility of a stagnant population or mass extinction, I have added the concept of artificial genetic drift to the environment. Every ???? turns, (can't remember, need to look at source) five of each kind of biot are added into the environment. This new random memetic information helps simulate an environment with less inbreeding than Biots really has. The newly added biots usually die out pretty quickly, but the occasionally add some good memes to the memepool.
Another bug I have discovered is that biots stops showing the sprites of the biomes after a few turns if you are running it using IE in Windows 2K or XP. I wholly blame Microsoft for this, with their stupid half-assed support of Sun's JVM. Maybe I'll fix it. Maybe I'll get around to figuring out how to scrap the whole applet thing and just compile it as an application. Of course, that would mean recompiling it for a bunch of platforms every time I update. Feh. IE just plain sucks anyway.
I probably won't be updating Biots for a while anyway. I need to write a web browser with a VUI (vocal user interface) by the end of the semester. This is my last full semester in college! Huzzah!
Wednesday September 11, 2002 4:34am CST
Crawl, strafe left, strafe right, and retreat are all implemented. I had some issues for a bit with showing the correct sprite, but I got it. It's a little strange. Especially watching the biots move in the wrong direction all over the screen. But I'll run them all night and see what they do with their new gift. Crawl goes (2/3) the distance as move and takes half the energy. The other three go the same distance, but take the same energy as a forward move because they should be awkward to the biots. I forgot to mention yesterday that I added an new object called
food. Actually isn't a real object, but if a biot is trying to sense food, or trying to eat or push food, and it encounters meat, fruit, or a fungus, it will act as if that was what it was looking for. This means that it is more likely to eat carrion, but must learn to avoid the poisonous fungus. A few days ago I awoke to find the biot population turning to face any kind of food, and eating meat and fruit, but pushing the fungus away until it was destroyed. How's that for a good behavioral adaptation?
Tuesday September 10, 2002 10:05pm CST
What is my deal? I've been adding pretty consistently to biots. I've been thinking about biots constantly, even in my classes. I've been jotting down not after note of plans for biots, but I haven't been updating my journal! The point of this journal is to record my thought process at any given time regarding what I have just completed. That way I can look back at how this project has evolved and remember things, ideas, plans, feeling, that I would otherwise have forgotten. Now I have to try and piece together the things I have done. The most obvious addition to biots is the
fungus. The fungus now spawns instead of every 100 or so apples. The fungus is poisonous to biots. It removes 2000 units of their energy. It does not, as of yet, become more and less negative as it ages, but I may change that at some point. The fungus has a little rotting effect, and I added some decay effects to other objects that previously did not have them. The rotten apple collapses after it rots completely away. The rock cracks when it has finally reached its maximum age. I also added a bite effect to the fungus and a purple spade to indicate sexual mutation. Another change was in the frequency of occurrence of certain actions and conditions when the memome needs to randomly generate new memes. This should make it a bit simpler Also in this version I think I'll call
1.21 I have modified the
push action a few times. At first the biots pushed an object without moving themselves, then the biots pushed objects and moved with it, which I thought looked cooler, but had a few problems. Number one being that this wasn't at all useful to the biots. Number two being that it lead to the biots being able to walk through rocks as long as they were pushing something. As much as I tried to correct the problem with case statements, it lead to too many problems, and since it wasn't too useful anyway, I changed it back. Then! Oh then I made a new change! A change that affects the entire world that the biots live in! A change that required me to add some more mutator functions to the biome class! I made pushing an object
reduce its maximum age. This means that a biot can cause another biot to become meat faster, even fast enough to happen before a malnourished biot starves. Which could lead to a new hunting strategy. It also allows biots to bust up rocks, though this required a team effort or a considerable amount of energy, given the high cost of pushing a rock. This is the first step in a new version of biots. In which it is not enough to simply decide to
eat another biot and have that be the end of it. No, I plan on implementing a full-on screaming combat and defense system! Attacks, venoms, elemental abilities, evasion techniques, tools for a biot arms race! Eating another biot will only be possible if the target is significantly weaker than you are, and battle must be drawn to weaken it! This will make carnivory significantly more costly in time and energy. This will work a lot better when I finally implement the genome, which will allow for varying strengths, defenses, speeds, etc. This will also allow for different abilities to be switched on and off. Speaking of future changes to biots.
I have some additions planned for the short-term as well. I would have already implemented many of them, but I've been too busy with classes. I have been experimenting with allowing the user to save and load the biots environment. I have not tried to implement a load yet, but I did create a menu option and method that saved all of the relevant information for everything in the biome array to a file. At first it was a text file, then I made it into a pretty html file, complete with an the current image sprite of the biome. I think I'll stick with the html file, because that way I can have the pertinent data on a separate line, while the descriptors of the data still appear to be on the same line when viewed with a web browser. This will make the file an easy way to look into the states and memomes of the biots, while still making it easy to parse the file when loading. The main problem is this. The file saving option only works when I run biots in the java applet viewer. When I try it in a web browser, it returns a bunch of security errors. I've explored using cookies to save the data, but I don't know how to get Java to talk to JavaScript, and I don't really want to install the whole servlet package, just to let java use cookies, so I've made a decision to turn biots into an application. I'll still have the applet version, but to save your environment, you'll need to download the application. When I do this I also plan on making the user interface less ridiculously stupid and ugly. Before I do that I think I'll add a few new simple senses and conditions. I want the biots to have a cyclical sense of time in addition to their linear sense. I will create an integer that increments to a certain value, and then decrements to zero, and repeats until the biot dies. Then I will implement a few functions to ask whether the biot is within certain phases of the cycle. For simplicity's sake, I think I will create four different phases and name them after the phases of the moon. New, crescent, half, gibbous, and full. I know that's five phases, but I plan on testing whether the biot is between two of the phases. I'll also add a few new forms of locomotion.
Crawl will walk two-thirds the distance of
move and use half the energy.
Retreat will crawl backwards, and
strafe will sidestep left and or right. I also may add a
compass sense, that simply tells the biot what direction it is facing.
Friday August 23, 2002 12:48am CST
In
Biots 1.2 I have fixed the issues with vision corresponding to the fact that the arctangent of y/x is not always equal to the corresponding angle.
I decreased the radius of vision to 50 pixels. This will make it easier for vision to evolve. I may make different designations for near, mid, and far vision at some point. I also fixed some energy issues with sexual reproduction.
The biggest addition in version 1.2 is a new action.
Push allows a biot to move an object around the environment. The energy cost of this is different for different objects, and is usually quite costly.
Finally, I added a new
info page, to the website. This one explains the various mechanics and objects of biots.
Tuesday August 20, 2002 11:43pm CST
Boom!
Biots 1.1 with Sexual Reproduction, as promised. And in less than 24 hours! All biots are hermaphrodites, when a biot has enough energy, it begins searching for a mate of the same species, when it finds one, it produces as
many children as it can with the energy it has stored up while looking for the sire of its children. The offsprings' memomes are a random combination of the memes of the parents. Memes are left in tact, the young biot randomly determines which parent will pass on its meme for each respective place in the memome. The children produced by sexual reproduction will have different memomes from their siblings as well. Currently no mutation occurs in sexual reproduction. I plan on making it happen, but not as often as with asexual reproduction. A big pink heart marks the biot that has just given birth.
Tuesday August 20, 2002 1:00am CST
Announcing the release of
Biots 1.0. It's been a long time since my last update, but that doesn't mean I haven't been working on biots. My friend
Ben wrote a bit of code to help give the biots a brand new sense, Vision! It took a lot of tweaking and a partial rewrite, but we eventually got it working
almost perfectly. Now the biots can sense whether a given object is within a 45 degree angle directly in front of it, or in one of two angles slightly to its side (a graphical presentation seems in order to illustrate this. I finally got around to adding the visual effects. Effects appear on the screen for one step in a spot where a biot just ceased to exist. They are there to show the user why they disappeared. A toothy growl appears when a biot is devoured. Apples show bites out of them and carrion is reduced to a bone when eaten. A biot that dies of old age becomes carrion, and if the carrion rots it becomes a rock, enabling the appearance interesting dynamic rock formations. Rocks disappear after 5000 turns. A biot that dies of starvation briefly leaves a grave stone. A biot that splits into two shows two cells dividing, white for normal asexual reproduction and purple when the offspring have mutated. Tagging the biots will now also show you the lines the biots use to guide their vision. There are now five species in total, frogs, mice, foxes, cats, and rabbits. The next step is SEXUAL REPRODUCTION!
Saturday July 13, 2002 9:12pm CST
Version 0.61 is up. I added a fourth species last night, Froggies! I made all the sprites myself based on the cat sprites. I also fixed up some of the old sprites
Wednesday June 10, 2002 10:10pm CST
I finally uploaded the new version (0.6) of Biots. I had it done for a while, but I never got around to uploading it because I had been experimenting in including a second species of biot. That worked perfectly, but the mice I added have crappy sprites, I'm going to work
on that very very soon hopefully. I did find some sprites of a very neko-like fox, so I also added that. Now there are 3 different species
that can occur in biots. It works to much better that way! It turns the stationary-predator -> extinction problem into trying to set up
a pred/prey relationship! Though I do have yet to witness a stable pred/prey relationship, I did notice one morning that all 3 species
had learned to eat all other species! When an animal speciates (there’s a 5% chance of speciation, I may reduce it to 1%) it immediately
vied for dominance with its former brethren. There was plenty of cannibalism, but it seemed to not hurt too much. I'm going to make the
mice resemble neko, soon, and also add a dog as a species, as I have several different doggy sprites. I think I'll try to make a frog
species too!
What else is new in the new version? I reduced the cheat level again, so now you have to add several individuals to get one that will walk.
They're still pre-programmed to eat and reproduce, because without the former you have to make a hundred to get something viable, and I've never seen anything come of leaving out the latter! I also added many new menu options! You can add individual species 5 at a time if you wish, and you can also remove all of one type of biome, be it the rocks, or any one of the species!
Abby made me a
stuffed Kirby doll!
Wednesday May 29, 2002 2:53pm CST
Well here I am, back in Milwaukee. Working in the
School of Education lab, hunting down and executing virii with an atlatl
named Regedit. Pretty.gen is pretty clever in its attack on things that can kill it. Even better than Sircam. Both of
those were someone's machine today. I think that may be the last time I get to go virus hunting.
There's been very little to do in that respect since we started scanning incoming attachments on the mail server. It's the
intelligent thing to do. All ISPs should do it. So should the main mail server on campus. We should also be honest with
ourselves and finally put
Real Player on the virus dat lists.
Damn all that live, I edited this here page using PICO via telnet whilst I was in Madison, and now all the carriage returns
are gone. Well, at least WordPad can wrap the text and make it a little more readable. Heyyyyyyy, wait... Okay, I found
an old file on my U: drive that I didn't have to edit much. Now I have my carriage returns back.
I had a great memorial day, spent entirely with the
Abigail. We got
Rasputina tickets and saw the new anime version of Metropolis, plus secret stuff!
Very little work done on Biots, I'm afraid. I went though and added a Memome class to Biots-3D and reworked ALL of the mutation methods. While testing I think I found something wasn't working, so I tried passing the Memome to offspring in different ways. I got illegal operation errors in runtime whenever a biot reproduced, so I think the old way was better. Now that I've left it for a few days I'll need to remember what I did last time. Ah well.
Abz and I are also looking for apartments for the fall. We need to have enough space for both of us and not pay too much blah.
Tuesday May 14, 2002 11:17pm CST I'm done with the semester! I start summer classes in late June, but for now I am
free. School has kept me so busy that I have not had a second to work on
Biots. However I was cunning enough to work
Biots into my final project for
CS-459: Computer Graphics. I present to you
BIOTS-3D! I
used Microsoft Visual C++ and the
OpenGL libraries to create a simple, three dimensional
version of Biots. I had to write all of the sensory stuff anew, as well as setting everything up for OpenGL, but the
original Biots memome-parsing code is mostly intact. Actually I ended up concatenating the code for all the sub-classes of
Biome into one class, and I changed the
Memome into two integer arrays stored in
Biome. I also ended
up simplifying the mutation to only do replacements, but much of that was just to get the thing done in time. I fully
intend to work on both versions when I have time. I think it will be easier to get Biots-3D's vision working. In fact I'm
sure I could implement it in an hour or two. Possibly in the near future. I also want to implement all of the possible
mutations from Biots. Biots-3D has Biots that currently look like wheel-less cars, food that resemble red spheres,
and grey, tetrahedrons for rocks. The biots also change color whenever they mutate and will not eat other biots of the
same color! I'm experimenting with biots not being able to run through each other. It has some interesting effects.
Perhaps I should jut make it a togglable option. It tends to cause traffic jams, and makes the biots access the lower
bounds of their memome more often, which often leads to cannibalism.
Also, as part of my project presentation, but
also something I've intended on doing for a while, I created
this page. Which explains just how
the memome tells the biots what action to perform. I've got animated gifs and everything!
Tuesday March 26, 2002 10:52am CST
I forgot to mention in the last update that I also tweaked the energy and metabolism of the biots. I multiplied everything by ten
in order to be able to divide numbers and yet keep them as integers. Then I made turning take half the energy of moving and resting
take only a quarter of the movement energy. Running takes twice the movement energy plus another quarter, and jumping takes
four and a half times the energy. All of these are computed in the init method of the biot and stored in memory to reduce the
number of multiplications and divisions done per turn. Since this weekend I have made a major addition to the program. (new version is
not up yet) I made it possible for the biot class to refer to multiple species without making a new subclass for each species. This is done simply
by adding the species type to the constructor and use that as a directory name when referencing the images that describe the species
so now all of the cat images are in the cat directory, but otherwise have the same filenames as the new species the
mouse which
are in the mouse directory. I used someone else's mouse images as a starting point and I'm still in the process of modifying
them to look cuter and fit better with the cats. I also set up the memome to know to what species they belong (for now anyway,
this is subject to change when I implement the
genome) and set up different initial memomes for the different species.
Currently the mice are told to jump when they feel a cat, to reproduce when they can, and to seek food using touch. The cats
are told to reproduce when they can, and to eat mice when they feel them. I've experimented with different programs for each
and different ways of modifying the energy gained by eating other animals, but so far I have not come up with an even remotely
stable predator-prey relationship. The cats either never get enough meat to survive, or they eat all the mice and then die off.
This was one of the major problems with Vivarium too. In fact, one of the main reasons I started this project was to improve
on Vivarium ideas, but my program is doing decidedly worse at a stable relationship. Hopefully I will be able to improve it!
I also added some new menu options. Naturally one to add mice to the world. I also added an option to add apples, mice and cats
at a rate of five at a time. Finally I added four new remove menu options. One removes only all of the rocks, one removes only
all of the cats, one for the mice and one for the apples. This is something I wished I'd had during spring break when I was
running experiments based on changing the environment by creating rock barriers. I think I'll go into these experiments now,
because observing behavior is one of the reasons to run biots, and I think I'll share with you some of the behavior I have
observed. (Jeez does my writing always suck this much?)
Experiment #1: Adding Rocks to an environment
One of the most obvious examples of machine learning in biots is the fact that if you put a rock in the environment with a
high enough population of biots, they will eventually learn to navigate around it. This is best done by only adding one rock at
first to give the population a chance to come up with a mutation that solves to problem. At first cats will walk up to the rock
and, not knowing what else to do, go right to sleep. Eventually one will come up with a solution somewhere in its code that
tells it to turn, curve, or jump when it cannot move. Sensing the rock isn't even necessary. In fact turning as a result of
feeling the rock is a worse adaptation than just going to sleep because the biot would walk up to the rock and just start spinning.
Curving and jumping are better options for an action to coincide with feeling a rock, but either turning, curving or jumping need
only to show up in the code after the movement fails, as long as they are paired with a condition that is true (
always
is best because
not feel cat and
not feel fruit may sometimes be false and lead to an occasional rock nap. Though
of course pairing
feel fruit and
not feel fruit with the same or similar action results in escaping the rock either way.
Anyway, turning and curving are the most common solutions to adding rocks to the environment. After the biots learn to avoid the
rock I usually add some more to keep them sharp.
Experiment #2: Building a trap
This experiment involves arranging rocks together to create a trap for the biots. This is done by observing the direction in
which the biots turn in order to avoid the rocks. Then by creating a small concentric curve of rocks with maybe a few rocks to guide
biots in. This results in a few biots that will hit one of the guiding rocks, and turn towards the circle, where it will
continue to run along the wall of rocks. It will not be able to escape the inner spiral because it only turns in one direction.
This results in the biot's eventual death, because there is a lot less food available in the small area than can be gathered
by moving about the whole environment. It is best to use a small spiral, like an open number
6 or
9 shape, to not
take up too much space and leave a large enough population outside the spiral to mutate a solution. When I ran this I expected
to get either biots that curved the other way, or biots that jumped over rocks to avoid the trap. Jumping biots was the result, but
I expect turning the other way would have been just as viable an option. Disintegrating the trap back to randomly placed rocks
resulted in the eventual switch back to turning to avoid rocks, probably because the turning cats wasted less energy than the jumping
ones.
Experiment #3: Closing off two sides of the screen and creating two mirrored traps
This was accomplished using
many rocks. First I evolved a population of jumping cats purposely for this experiment.
I did this by removing all biots any time the first cat did anything but jump over the first rock. When I had my desired
individual I closed off the border of the environment using rocks, and made a vertical wall down the middle. Then I put a rock
a little bit about the lower left, and lower right hand corners of the border, resulting in two mirrored circle traps. The initial
population could jump over any obstacle, but if some started to curve, those in the left side enclosed area would need to turn left
to avoid the trap, and those in the right hand side enclosed area would need to turn right. This way I would have 3 different
types of cats co-existing in one environment! My hypothesis didn't turn out, however, even though I ran the experiment several
times overnight. What I got instead was a population of jumping cats that would stop jumping and start turning if they got too hungry!
This was a great solution to the problem! Though of course it worked better on one side of the environment than the other. I was
expecting three populations, but instead got one that was able to do both things. Jump around while it could, and then skate
around the border of the walls when it started getting low on food.
Saturday March 16, 2002 3:20am CST
It's almost been a month since my last update. And this time it's actually been a month since I've had a chance to work on
Biots at all. I've been doing some interesting things in my graphics class, that I will probably upload here. We've been
programming 3d and 2d stuff in
OpenGL. School has been taking up too much time for me to
get anything done for Biots. There are a lot of things I'd really like to do for this program, but I really need more time
to invest. I'd also like to eventually bring some more people on to the project. I need a good save/load feature for the
biots, and I need a better and prettier options interface.
Version 0.53 is up now. This is the first version that has been
actually released that had the
curve left and
curve right biot abilities. These have also been fixed in this
version. Previously if the
move portion of the curve failed, the biot could turn and still do something else. Now
if curve fails, the biot turns, but doesn't do anything else. This is also the first version uploaded to have the
tag biots
option in the menu. I also went through the code and commented out all the vision
code. It was taking me too long to get it to work, and I'm not going to have a chance to work on it for a while. I have break
this week, but I'm going to Madison without my computer for the week. Hopefully I'll at least get some more
drawing done. The other changes in this version are that the cheating level is increased a bit
(Now the biots will move forward by default when they are first created) and I created a new mutation type.
Priority Shift
rotationally shifts the entire meme up or down.
Tuesday February 19, 2002 12:49am CST I've been really busy lately, but I have been working on Biots. I added some new movement types.
Run,
curve left, and
curve right.
Run moves twice as fast as
move, but half as fast as
jump. And curving moves and turns all in the same step, using energy for both. I think these make the movements a little more lifelike and at least more interesting. I still haven't uploaded a new version because vision is still not working properly. I used the
Polygon Java class to create eight triangles for each biot, one triangle for each of the biots' cardinal directions. The biots also have three other triangles that are used to reference the direction triangles. The three triangles correspond to forward vision, right vision, and left vision. This should not only allow biots to sense things farther away, but also to discern where they are in relation to themselves and the direction in which they are facing. The three vision triangles are set to reference the correct directional triangle whenever the biot turns (and they are also set up during construction.) I might have an xpos and ypos switched somewhere though, because the vision does not work properly. It doesn't seem to work at all, in fact, for the initial biots planted in the environment, and works screwy for any offspring. Which is strange because I call the vision setup methods in both constructors. I don't know how long it will take me to figure it out. I'll try to get some of my friends to review the code and see if they can find anything.
Thursday February 6, 2002 11:47am CST Yesterday I fixed a bug that made it impossible for the biots to acquire the memes for "feel rock" and "not feel rock" but version 0.51 is still the one that is up because I started work on the code for vision but was unable to complete it. Don't worry though. There are many ways for the cats to avoid bumping in to the rock and staying there without actually feeling it. When the movement action (or any action) fails, the biot just looks at its next condition/action pair. If that allows it to turn or jump, then the cat will turn until it can move, or simply jump over the rock. Which is good because it may take me a while to upload 0.52 because vision needs to distinguish whether something is to the left or right of the biot as well as in front. So far all I have is an
ISeeAhead method, which works for the non-diagonal directions only. I really need to see if
Java supports polar coordinates. That might make things much easier. I've been doing a lot of work on paper lately as well. Mostly trying to figure out how I want to do the
genome thing. But also what new species to add, and some interesting new ideas for abilities. But first comes vision and sexual reproduction! I also want to work on a new user interface. I would like there to be a separate frame that you can drag an object into to get its information and perform actions on it such as saving, cloning, and deleting. On a side note: sometimes you can speed up the applet my moving your mouse around. My friend
Tom pointed out that this is because the random number generator uses input devices as part of the basis of generating a random number. Random numbers aren't used at every step, though they play a big role in initialization, reproduction, and food spawning.
Tuesday February 5, 2002 11:15pm CST In ver 0.51: Fixed a bug that made apples stop spawning when you increased the spawn rate. Aaaaaand I added
Rocks to the world. Tweaked some methods in
biot and gave the cats the ability to sense them! Oh and I am announcing officially that the program will henceforth be known as
BIOTS! Hooray!
Monday February 4, 2002 10:48am CST This weekend has produced version 0.5 which includes an ugly, poorly placed, but functional option menu, and apples that start out unripened! The options are:
Add Apple,
Add Cat,
Pause/Unpause Applet,
Faster Apples,
Slower Apples, (which refers to the rate at which new apples are added to the environment. The maximum speed is 1 every 5 steps)
Speed Up Applet (which won't do much if there have been a lot of objects on the screen because it's already going as fast as it can by then)
Slow Down Applet, and
Remove all Biots. Later I will make the menu prettier and add options about how much "intelligence" the initial biot should start with. Now the biot starts out with a little less help from me. It is told to reproduce when it can and to eat fruit when it feels it and nothing else, so to get a good starting biot you may have to use the
Add Cat option from the option menu. Or you can
Remove All Biots and wait for a new one to respawn, because the other addition to this version (it was actually added Saturday for version 0.41 or so) is the feature of a new cat getting spawned instead of an apple if there are no cats left in the environment. This was you can leave them unattended without worrying about restarting the applet if they all evolve cannibalism and annihilate each other. Another addition is the turning off of the little debugging numbers by each biome. They can be turned on in the code by changing a boolean flag (I could put that in the options menu too) and now the numbers are blue so they are easier to see.
Friday February 1, 2002 9:15pm CST We'll call today's version 0.4. It features eight, count 'em, eight new conditions. These conditions are all internal states of the biot. They are: hungry, not hungry, full, not full, juvenile, not juvenile, ancient, and not ancient. "Not hungry" and "full" are not the same thing. There is a large area in between. The numbers used to determine these states will be, as most of the numerical variables of the biot, determined by the genome, and therefore different for eat biot. I created some new gifs that will be used as visual effects for the applet. So far the only one implemented (at least noticeably) is that near the end of an apples life it will turn rotten, when it is rotten it is worth less energy than when it is ripe. (Hmmm I could have unripe apples too!) Rotten fruit only stays on the screen for a bit before it decays away completely. I want to have an image to depict all kinds of events that aren't implicitly clear, such as being eaten by another animal, dying of starvation versus old age and reproduction with mutation versus reproduction without. I will accomplish this by modifying eatenBiome() a bit. I also found where my very occasional arrayIndexOutOfBounds exception was coming from. Some mutations weren't allowing for the fact that the length of the memome is malleable. This has been fixed in 0.4!
Thursday January 31, 2002 11:01am CST I popped slightly newer versions up online a few times since Tuesday. Mostly attempts at bug fixes. I think there is still an occasional array index out of bounds exception in there somewhere. In the latest version (0.3?) I have double-buffered the graphics which means no more flickering. It basically works by drawing everything that will go onto the screen to an image first, then pointing the screen at the image while at the same time drawing the next frame to where the image used to be. Thanks to Aaron Bryden for pointing that out to me =). A major addition to the code (though it only took about 3 lines) is a new type of action. This one is called
pass. All it does is return false when the biot tries to execute it. The
pass action and
never condition allow the biot to have dormant memes that will only show themselves if a mutation gets rid of the
pass or
never. Another important addition was a simple alteration to the part of the code that makes the biot wrap around the screen when it walks off. Now the world is set up line two perpendicular corkscrews. A biot walking off the screen to the right will end up on the left side of the screen about 2 steps (30 pixels) higher than it was. Going off the right side brings the biot down 2 steps. Going off the top of the screen brings a biot to the bottom 2 steps to the right, and going off the bottom brings a biot to the top, 2 steps left. What this does is get rid of the major advantage that moving diagonally had over moving horizontally or vertically. Not horizontally and vertically moving biots will cover much more ground when walking forward continuously and therefore have a better chance of getting food. This makes the population more stable, which is good, because sometimes it takes a while for the biots to evolve better food-seeking techniques. I want to add vision, sexual reproduction and a better user interface soon, but classes are starting to pour on the homework, so it may be a while. I tried allowing some keyboard input to add a new biot or food, but for some reason the applet wouldn't execute the methods. I added the keyListener, defined the methods, and made the applet implement keyListener, so I don't know what I'm missing. System.err.println shows that the keyTyped, keyPressed and keyReleased methods aren't even being called! Ultimately I want the user to be able to drag a biot into another panel, which will display its stats and full memome as well as allow you to save it to a file and reload it into the environment later! I should think more about the genome sometime soon as well.
Tuesday January 29, 2002. 1:40pm CST Alpha version is
up! I was having trouble getting it to work on Netscape and IE even though JBuilder was doing it. I realized I was using the
set method, which worked in JBuilder, but it was really meant for the
List class, the browsers wanted
setElementAt. After fixing that everywhere in the code. I noticed my telekinetic apple eating bug wasn't really fixed. I fixed it now. Enjoy!
Tuesday January 29, 2002. 3:02am CST I should really be asleep now. I have to get up at 8:30... I think I'm able to release a version now. I gave up on the vector for the biomes for now, I realized I'd have to change a lot more stuff. So I put back my original code (always keep a backup) but then I made the memome into vectors. That worked nicely, making the mutations so much easier to execute. Then I was still having the crazy mutation bug. Then I realized what was wrong! It was in the constructor for the new biots that were created by asexual reproduction. They were getting a reference to their parent's memome, not their own! So I created a
cloneMemome method that uses the
clone method of the two vectors that make up
Memome. That bug fixed, I made it a little easier for biots to eat food when facing in a non-diagonal direction. Before they would miss food that was displaced a little in a perpendicular direction. Luckily all I had to do was increase one of my static integers for that. Finally I noticed a bug where an biot would eat an apple that it was no where near. Surprise! It was for the same reason I was having trouble with the vectors for the biosphere. So I rewrote the code to fix that. I'd still have some issues if I converted to vectors again I think. But I might be able to resolve those too? Maybe not. Anyway I'm going to try to get a version online now.
Monday January 28, 2002. 4:00pm CST Zonk suggested that I use vectors instead of arrays for my biomes and memes. I think he's on to something there, so I spent the weekend converting the biome array to a vector. There are some bugs because of that still, but nothing I can't handle. The applet runs much faster now, and I was able to do a way with a few methods entirely. (Though I was proud of my dynamic memory allocation from scratch.) I think my spontaneous mutation of the entire population bug will stop after I convert the memome to use vectors.
Friday January 25, 2002. 12:12pm CST ARARARARARARARGH! Okay I fixed the bug in the asexual reproduction by completely rewriting it. It's a lot cleaner now. I should have remembered that it was easy to get out of a for loop by putting it in a private sub-method (in this case
int findOpenArrayIndex()) and returning when I need to break out. I was also able to use
findOpenArrayIndex() in the
spawnFood() to make it much more efficient. The thing I'm rarring about is this bizarre bug where occasionally when one of the biots mutates all (or most?) of the other biots in the environment get the new memome too! This does not always happen. If it did, it would be much easier to troubleshoot. I've been working on it all night and I really have no idea why this is happening. Maybe one of the biomes is told that it has a index number that is not correct when it gets assigned to a spot in the array, but I've looked really hard for an instance of that and I can't really find one. It has to be something causally linked to a randomly generated number, that at least would explain why it only happens sometimes. But that doesn't really rule out much. A lot of the methods use a randomly generated numbers, and everything is causally linked to a random number eventually.
Thursday January 24, 2002. 1:21pm CST I think I should comment that I have been working on the program all week. I got back to Milwaukee on Sunday. I've been working but forgetting to update the journal! Actually I updated on Tuesday when I was at work, but that entry got lost because I updated the version on my hard disk instead of the one online. Oops! There are probably some things I may not have mentioned. Eating fruit now only gives 200 energy (I think, maybe it is still 300.) I added a jump ability, which moves forward 4 times as quickly as move, but is likely to jump over food sometimes, it's really more useful for escape or getting over the obstacles that don't exist yet. Jump uses 150% of the energy that move uses (which is currently 2.) Relax uses 1 energy. Eating a prey gives the predator the exact amount of energy the prey had. Apples spawn pretty quickly, but there cannot be more than FOODMAX (currently 10) apples in the environment at a time. One of my concerns now is that the graphics on some of the biomes gets flickery when there are a lot of biomes on the screen. Smaller graphics may be in order, this will also allow for a less crowded environment.
Thursday January 24, 2002. 11:37am CST Well here I am at work again. Last night I did indeed accomplish the last task necessary for true a-life, namely mutations. Mutations allow for variation which, along with competition, makes evolution possible. I have created seven different types of possible mutations that the memome of the biot can undergo. Here are some notes I took while trying to think of how to do these mutations.
Possible types of memetic mutations: - Mispairing: One array gets offset by one (rotational)
- Random Replacement: One string gets changed randomly to another*
- Pair Swap: Two Allele pairs switch places
- Single Swap: Two actions switch, or two conditions switch places.
- Deletion: Array length is reduced by one and a random pair is deleted
- Addition: Array length is increased by one and a random pair is added
- Duplication: Array length is increased by one and a random pair is duplicated
*It should be more likely for a condition to change to a similar condition and an action to change to a similar action. For instance "Feel Cat" should be more likely to mutate into "Feel Fruit" than to "Never."
Speciation will be handled by the genome, not the memome. When two individuals with different length memomes try to mate, the offspring will either have the shorter or longer length, if shorter, the arrays are truncated at the end, if longer the parent with the longer arrays will pass the last few strings directly to the offspring.
And that's it for now, except for some speculation of getting actions to point to other condition/action pairs and conditions to point to (condition/boolean-operator/condition) pairs.
Anyone familiar with arrays will realize that the last three types of mutations were a pain in the ass to get to work. They involved created a new array of the new length and trying to walk through both arrays and put things where they belong without getting null pointer and array index out of bounds exceptions. But I did manage to implement them all in a little over a day. The mutate method is called by the biot right before asexual reproduction, it has a one in ten chance of there being a mutation, and then randomly selects one of the mutation types and executes it. I should also mention that in order to give the initial biots with the randomly created memome a fighting chance to not go extinct after one generation, I added a bit of code that puts the ready made condition/action pairs "always/asexual" and "feel fruit/eat fruit" into slots 0 and 1 of the memome arrays. These are popped in after the complete random memome has been generated (overwriting the previous contents of slots 0 and 1) and are only added if the boolean flag
cheat is set to true.
I had to add a new method to the Die class of my Dice package to make the code run smoother here (and not keep getting the same "random" number every time.) The Dice package is just something I created a while ago to import to my other programs. It creates random integers between one and the number you pass to it. This is more useful to me than a random floating-point number between 0.0 and 1.0.
Like I said last night, it's all still pretty buggy, so release of version 1.0 will probably have to wait until the weekend. I've been trying to fix the asexual reproduction methods, which occasionally will fail to work, probably because the biome array is full. It's supposed to double the size of the array when that happens but sometimes a biome will fail to produce offspring (or only produce one) and then will destroy itself. When I went in last night to fix it I created a new bug, now if the reproduction fails, the biot will double the array size and call the method again. This results in the successful creation of two offspring, but also allows the parent to survive (or perhaps creates 3 offspring?) either way, it's something I really need to fix.
I think I should also add a few more conditions, such as
hungry,
full,
ancient and
juvenile. That might make things a little more interesting.
Thursday January 24, 2002. 12:38am CST IT'S ALIVE! Very buggy, but alive. More info on the morrow.
Friday January 18, 2002. 7:31am CST I spent all morning bug hunting. Mostly dealing with array out of bounds and null pointer exceptions that were likely to arise when I changed some numbers around. I really wanted to put the Memome into its own class and work on adding mutations and a random initial memome, but It's going to have to wait. I did add dynamic memory allocation! Interestingly enough it was the first time I ever really tried using dynamic memory allocation for anything practical. But now the Biome array will double in size when necessary. I did tackle a lot of bugs tonight. Today is my last day in Madison for a while. School starts Tuesday. Better get some sleep. Hopefully, I'll get mutations done soon.
Thursday January 17, 2002. 7:23am CST I got asexual reproduction to work. One Biot splits into two new ones. Then I made it so that movement and turning reduced the total energy of the biot by an integer called "metabolism" which I initially set to 10, but 2 seems to be fairer. Biots get 300 energy for eating an apple, start out with 500 energy and need 900 energy to reproduce. They also starve to death if their energy drops below 100. I currently have their genome set up so that all the biots have what I would consider the ideal set of instructions for evolutionary success. It breaks down to something like "always try to reproduce, if I can't see if I can feel and apple, if I can, try to eat it. Failing that, see if I can feel an apple again and if I can turn left. If I don't feel an apple at all then always move forward. " The rest of the biot's internal program is not viewed by the program yet, I have to fix that, but it wouldn't matter so much because move never fails as the program is because there's no rocks to block the biot's way yet. Oh and the other big addition of the night, apples are now randomly spawned at a rate defined by the foodRate integer. This, and the reproducing biots mean that I almost have created Alife. They only real thing remaining is the mutation of the genome to allow variation, plus randomizing the genome initially would make it more interesting. Then I have life! Hooray! I'll have to find a good balance for the way metabolism and other things are set up and make a good interface for starting out the environment with the desired number of biots and spawning rate for the food and all before I release version 1.0.
Addendum: The thing I mentioned in the last addendum was done a while ago, I dunno when I did that, but I thought I'd mention it now that I thought of it. Also, I don't think JDK was really freezing. It turns out it just really needed to wait an excruciating amount of time before starting up.
Thursday January 17, 2002. 3:34am CST I actually did what I was describing in my last entry quite a while ago. I've worked on the program at least twice since my last update but I didn't get around to updating this here journal. There was a LAN party and other stuff going on. I plan on working some more on my program tonight. I'm watching "
Young Frankenstein" on
AMC right now. There's a movie I can relate to. It's nice to see someone "play God" as it were, and end up with a happy ending. A nice change from all the technophobic episodes of "
The Outer Limits." That show made me decide that I'm going to write a "wig out and destroy humanity" method in every program I write. I have yet to do that in this program. I still have to get the asexual reproduction to work correctly. It seems to at first, but after a generation or two, some biots split into five instead of splitting in two. That's my next problem. Next Tuesday classes start up again, I might be able to release version 1.0 by then. Hey, I need to think of a name for this program!
Friday January 11, 2002. 7:37am CST I spent all morning working on asexual reproduction. No not of myself. It basically works, but I get some funky effects when I put one of the newly created biots into a slot in the array occupied by its parent. Probably because the biot needs to spend a whole step as an eaten biome for some reason in the code. Oh! I know what I'll do! I'll mark the parent as eaten and create two children, and the place the children in the array by searching for the earliest spot in the array with an eaten biome!!! I'd have done a lot more if JDK (my compiler) didn't keep freezing. Even JBuilder (my programming environment) froze on me twice, which means I needed to rewrite code. Sad, sad. Well, life soon! Now for sleep.
Tuesday January 8, 2002. 3:22am CST Huzzah! It works. It all works! I fixed all the kinks tonight. One major problem was that I had a true where I wanted a false and a false where I wanted a true. After I fixed that, only one action per step was taken. Then a strange bug arose where the kitties would freeze when facing the apple from any distance, but only after trying to eat it. (as I figured out by stepping through the code) The problem? tryEat() doesn't call eat()! Well it does now. Now the biots follow a miniature program that is dictated by the contents of two arrays of strings. All I have to do is make those string arrays a part of a new class of object that lets it get created randomly and then mutated when the biots reproduce and then I've got my genome/memome object. I can almost taste demiurgedom now! Too bad I'll be partying in Milwaukee tomorrow night without my computer. Well, soon enough!
Addendum: The tryEat and eat methods really should both take a string that is the biome type of what the biot is trying to eat as an argument and check to see that what it is trying to eat is of that type. It works correctly right now, but it feels like a kind of a hack job. I think it only works if the thing we're trying to eat was the subject of the IFeel method. Until I put in different senses, it really shouldn't matter.
Monday January 7, 2002. 5:30am CST Wow! It has been a long time since I've done any sort of update or worked on my program. I guess vacation gave me a lot more to do than I thought it would. The time I didn't spend hanging out with
friends was spent drawing
anime versions of my friends as a Yule-type gift.
Brian has scanned those in for me (my scanner is in Milwaukee) so I should have those up on the site eventually. I've also been talking with
Zonk about another new project. That should take us a while to complete so I won't mention it until it becomes more concrete.
This morning's coding was quite productive! I had just been poking around at the code earlier this break, so I decided to sit down and write out some serious pseudocode and figure out just exactly how I'm gonna get the biot's commands to be malleable and all that. I wrote out a page of code yesterday afternoon, and this evening around 3:00am started coding it for real. I had to change very little and I think this is really going to work. It's too much to explain exactly what I did here, suffice to say that now there are two string arrays in each biot. One is a list of conditions (e.g. "feel apple") the other is a list of actions (e.g. "turn right") the biot goes down the list of action/condition pairs and does the action if the condition is met. Actually that's what it should do. Right now it seems to only be working half right. Maybe it's doing more than one action per turn? I'll work on the kinks later on, but for now I'm happy with my major step forward. Once I get this running I think I'll implement asexual reproduction, then get the action/condition pairs to be part of the genome data type that gets passed on and mutated. I'll also make the genes randomly created when the initial population of biots is spawned. That and setting up the whole needing energy from food to survive thing will yield true artificial life!
Wednesday December 12, 2001. 11:00pm CST I haven't had too much time to program lately. Monday was my 22nd birthday, and this week I've had a lot of homework due, including a take-home physics exam Tuesday, and physics homework tomorrow. Next week is exams, so I can't expect to get much done until Tuesday evening when they are done. I'm coming home to Madison on Thursday and I'm bringing my computer, so I should get a lot done over winter break. I don't know how much time I'll have next semester, I'm taking a pretty heavy load of classes. Mostly computer science even. Tonight I made my code a bit more efficient by taking the out the references to unused images from the "imgsrc" string array. I also rearranged the strings to refer to the images in the order of their directions, which allowed me to make my code in dealing with image turning and swapping much more efficient. I deleted probably over 30 lines of code that way. I also fixed a bug that made the biots not eat when they were pointed down-left or up-left and facing the food.
Oh! Plus I programmed a version of
Langton's Ant on my TI-82 calculator today.
Saturday December 8, 2001. 7:19am CST Damn, I've pretty much taken care of everything I need to in order to start the real
genetic programming stuff. The issue of drawing the image so its x and y positions are at the center of the image is solved. The issue of the eat method wrecking the biome array and eating when it wasn't facing the right way are solved. I needed to get out a pencil and paper and draw coordinates for the latter, and the former was solved by setting the dead biomes to "new eatenBiome();" instead of null. The picking up of the biomes works even better now too! I changed the apple gif so that it was the same size as the cats, 32x32 pixels. I could add some eating and dying gifs for effects, it depends on how ready I am to tackle the real soul of the program. I have more than a few ideas of different ways to go about this. One is the same method used by the program that was the original inspiration for me to write this one, Vivarium, which is an Alife program for the Mac developed by Ryan Koopmans at
E-Brains. Vivarium no longer seems to have a web page, but it is still
available from the E-Brains public ftp site. The other Alife-like program done by Mr. Koopmans is
Genetic Wars which does still have a website. GW uses the same genetic structure (I'm assuming) as Vivarium, but the creatures are selectively bred by the user to win battles instead of breeding on their own. I highly recommend them both if you have access to a Mac. I can only play with them when I'm back in Madison and can use my mother's G4. Anyway, I
could use the technique that I think Vivarium uses. That would be the easy way, but it doesn't allow my programs to branch in new ways. I really want my biots to be able to have interesting complex programs. On the surface just if(x){y} statements, but x and y should be data structures where x can just be a condition, or two conditions separated by an
and or something in the format of
not(a
and (b
or c) ) etc. And y could just be an action for the biot to perform, or it could be another
if statement. How the hell do I do that? I have some ideas on paper. I'll have to work on it.
Friday December 7, 2001. 5:55am CST Wow, my last update was 12 hours ago and I haven't slept. I didn't really sit down and take a crack at my applet today. I just kind of picked at it. But lo, I was greatly successful! First I made the interface a little more efficient. It is SO much easier to pick up a biot with the mouse. Now dragging a biot will cause it to pause, and the biot you clicked will follow the curser as long as you keep the button down. Before, you had to move it slowly, and the running kitties escaped your grip. Which was fun, really, but not very practical. Gone also, is the annoying stacking of the biots if you drag the mouse over more than one. Now the first one you click is what you get. I had to fix some null pointer exception that arose from this. But I knew I would. I also added a little debugging feature that puts the index number of the biome array in the upper-left corner of the biot's image. This was extremely useful in fixing the problem of only one cat eating the other. Turns out I had an else where I didn't want one. Now when I set the consequence of IFeel(string) to relax() they both relax. The eat method is still giving me problems, but now I know exactly why. First I had to get rid of some remaining null pointer exceptions and array out of bounds exceptions (the extra i++ in a for loop was a dumb idea for skipping an index.) The problem is that eat() sets eaten biots to null, but setting a member of an array to null also nullifies all of the members after. So eating biome[3] is no problem, but eating biome[2] takes biome[3] with it. And eating the apple, biome[1] destroys all the biots! I'll have to come up with something else. Create a biome subclass called eatenBiot or something, and set the eaten biot to a new instantiation of that instead of null. That would be interesting, then fruit could use getting eaten to plant seeds! I also might want to set up a way to mark array members as being open for new instantiation. So a newborn could be put into biome[2] after the original inhabitant of biome[2] dies. I would just use an int array to keep track of open slots, but I’d still have to write something to the array to make the first biot go away and to have something to check against a nonexistent biot getting called upon to perform a method. Obviously now I use (if biome[i]!=null) in front of any such code.
Thursday December 6, 2001. 5:44pm CST I actually did some programming Monday evening. Monday's post was from Tuesday night, you see. New days have a funny way of sneaking up on you around midnight. Anyway, I haven't touched the program or posted here since then, because of reasons. I was posing for some photos for
Abby, doing homework, and trying to sleep enough to be awake at work. I failed at that last attempt. Enough of that. Monday evening I was working with the eat() and IFeel() methods to make them more flexible. My cats were only eating apples, I was trying to let them eat other cats as well. I know it's horrible, but I only have two kinds of things in the world right now and I had to figure out how to let eat() do more than just check for the apple. I was half successful. One cat can eat the other, but the other can't eat the first. I have IFeel() lead to relax() instead of eat() for now so I can check if both cats successfully feel each other when they get close. Only one will go to sleep. I think it's just a problem with a for loop and the array again. I'll play with that tonight hopefully. I know the problem isn't the cat detecting itself, I already wrote a clause to get around that. Physics time!
Monday December 3, 2001. 12:53am CST Created the Biot class and took the code out of Biome that should only apply to Biot. Then I fixed the errors that inevitably rose from that. Works the same as it did last night, but makes better use of object-orientation.
Saturday December 1, 2001. 8:46pm CST Last night was full of chocolaty goodness. I created the Biome array and kneaded the code until it worked again. It took a little while to figure out why some things weren't working. After that I made it so that you can move any object by clicking near it at dragging it. I need to work with the code to make it more efficient, to pause the Biome that is being moved, and to only let you move one at a time. Right now if you drag the apple onto the cats you've got them all in a stack and you can't separate them. I think I know how I'll do it, just use a few boolean flags and such. I also made it so the cats will eat the apple if they are facing it. Setting the apple to null works now because it's just a member of the array and the for loops that go through the Biome array check to see if the array is null before any code is executed on them. There is a problem with the diagonal directions and eating though. If the cat is facing diagonally up/right for example, it will eat the apple if it is right above it or to the right of it or in the proper area diagonally above and to the right of it. I don't know why. My if statement uses an "and" not an "or." I'll fix that next time hopefully.
Friday November 30, 2001. 4:52am CST I Moved the code to sense biomes from the Environment class to the Biome class. It just Makes more sense for it to be there, and should help me do things. I mainly just experimented with what I could do today. I added a mouseListener and a mouseMotionListener to the Environment Applet and defined some of the mouse methods so that the apple goes wherever you click or drag it. Fun fun. Ideally I'd like for whatever you click to go where you drag it, but that may be a bit more complicated. I also noticed that when things are drawn, the point at which they are drawn is the upper left corner of the picture. I need to do some correction of the x and y positions so the pictures get drawn with their center at the point used for detection of the object. Finally I tried to find a way to delete the objects I've been dynamically creating. I'm used to
TADS, where you can use a
delete operator, just like a
new operator. No such luck for Java. I don't want to have all of the Biots that die and Food that is eaten to sit and take up memory. That would just ruin everything, as you can imagine. I think I'll be able to deal with it when I actually move the object instantiation into the Biome arrays. Assigning an object that is still being used in your code to
null is bad. Imagine life as you know it ending and every molecule in your body exploding at the speed of light. Yeah, just seeing if you were listening.
Wednesday November 28, 2001. 2:42am CST WEEEEEEEEEEEE! I've introduced a big shiny apple into the environment! And guess what? Now the Biots can sense if the apple is within a certain radius! The radius is a static int currently set to 40 pixels. So now my little creations have their first sensory input capability! So far I'm having them just take a nap when they get near the apple. I need to sleep so I can be awake at work for once. My physics wasn't due today, I realized last night that it will be due Thursday evening, so I only did one problem. I spent much of the day looking at other people's Alife stuff. There's some really cool stuff out there that I'll have to link to.
Monday November 26, 2001. 11:32pm CST I really want to start adding the food to the little universe now. I've made lots of progress this evening, but I really need to do the physics homework due tomorrow night. I've introduced the concept of "direction" to my biots. Now the move method makes the biot travel in the direction it is already facing, and the turnright and turnleft methods turn the biot an eighth turn to the right and left, respectively. I've cleaned up much of the code that I'd been messing up whilst trying to fix the paint method, so now I'm ready to deal with some real
ALife stuff. But to do that I need something for the biots to sense, then I need to implement those senses. I can see that being difficult if communicating coordinates between different biots poses the same problem I had with passing images to the applet. Anyway, tonight's major changes are as follows. The two biots are now spawned at a random location on the applet. The applet's step method calls the biots step method, which tells the biot to move, turn right, turn left, or relax, depending on a random value between 1 and 4 which is determined upon the biot's construction. The initial direction of the biot is also determined in the constructor, this is a variable between 1 and 8, with 1 being "up" and going clockwise from there. So now if the move method is called, it checks the direction, and then calls the method that tells the biot to move in that direction. (e.g. if the direction is 8 the "moveupleft" method is called by the "move" method) I mentioned the turn methods earlier. The relax method displays the sleeping images that I used in
randcat. I figured biots should be able to conserve energy, once energy is brought into the world. I would have called the method "rest" or "sleep," but those are reserved words.
Monday November 26, 2001. 3:41am CST Eu-fucking-reeka! Just before time forced me to go to bed I figured out how to get the damn Cheshire cat blinking to stop. The graphics method has to draw all of the biomes at every repaint, so I need to have it go through a for-loop that cycles through the array of biots. This makes the step method do a lot less, as the paint method now asks the biomes directly where they are, and what they look like. Tonight I also made each biot (there are still only two) do something different based on a random number generated during the biot's construction. When the constructor is implemented it instantiates my good-ol' "Die" class and executes the d8 method (generating a random number between 1 and 8) which is perfect for the cardinal directions. So now when the applet is started the biots will each go in one of eight random directions. This will be the basis of newly created biots having a randomly generated genome/
memome. Of course biots created by reproduction will have a different constructor that takes the "DNA" of the parent as arguments.
Oh yeah, and Thanksgiving was fun. It was nice to see
everybody again.
Tuesday November 20, 2001. 11:25am CST Last night's coding attempts were interesting. I'm having problems already and I'm not even dealing with the real
AL stuff yet. My troubles lie in drawing more than one biot to the screen. The way the program is set up, the cat (so far the biot is just using gifs of
neko) is erased and redrawn to the screen each time it moves. When I try to have more than one instantiation of the biot, the first cat is erased while the second one is drawn, which leaves me with a couple of strobe-light Cheshire cats.
Still, some progress was made. I made the biomes move back to the other side of the screen when they walk off camera. I moved the code that communicates with the biots to a private method that only the applet can call. This is called from the run method which exists because the applet is mimicking a thread, which gives me nice start, stop and pause methods to work with. I had some thoughts in the shower when I decided I should try to get four hours of sleep before
work (which is where I am now, yay!) Before I get into this I want to say that I have thought about this project extensively
before starting any actual coding. I have over five pages of notes and pseudocode, so I had a pretty good idea of how all this stuff was going to work before I just jumped into the project. I am, however, picking this project up from about a six month hiatus of either no coding, or writing the "
Let's Kill" text adventure in
TADS. I should definitely finish that some day. Anyway, these are thoughts I'm sure I had before but couldn't really remember.
First: How am I going to dynamically instantiate biots as they are created? So far I've just been instantiating them in the applet code with a kitty=new Biome(50,50); The parameters being the x and y positions where the biot spawns. The answer is obviously that I will start out using an array of Biomes and construct the new biomes into the array in the asexual (and later sexual) reproduction method. Maybe then I'll look into what kind of more memory-efficient solutions exist in the standard library.
Second: I remembered what I had actually planned on doing last night was make the applet call a method in the biome's code that determines which action/s to take. So far the applet tells the biome what to do directly, and it tells one biome (kitty) to do one thing and the other biome (cat) to do another so that they move in different directions and I can tell them apart. I had been distracted by my Cheshire cat effect and forgot to do that. I should do that tonight. Only tonight I should actually not code and study for my discrete mathematics exam instead. Mayhaps after Thanksgiving.
Third: Some of my graphics troubles stem from the fact that applet has methods defined for it that my Biome class does not. If the biomes were allowed to send their images to the applet instead of just the name of their image it might solve some of my problems. Or then again it may be a horrible waste of memory. But I did realize that I can import the graphics methods into the Biome class (duh!) Why am I doing the graphics first and the actual cool AL stuff after that? Because it's more fun and quite useful to be able to watch my code move around on a 2d screen instead of display a bunch of debug information that I'll have to remove in the final version anyway. Not that I don't display any debug info, the biots coordinates are displayed on the screen right now. Also, the code that will simulate the biots senses will use the coordinates of the screen, so the display is an integral part of my code anyway.
Why am I using the term biome in my code and biot in the journal? The Biome class will probably end up being a superclass that will include biots and the food that randomly spawns on the ground. For now I'm not going to bother making the Biot subclass. I can move the necessary code when the time comes.
Monday November 19, 2001. 11:00pm CST This is the beginning of "The journal of a
demiurge" in which I log my attempts at creating life (muhahahaha! etc.) What I am attempting to do is use java to create artificial biots that will reproduce and evolve as they compete for food. Each biot will have a
haploid set of
memes that dictate its personal behavior. The biots with successful
memes will survive to reproduce, and the biots with bad memes will die. Each meme will consist of a conditional if/then) statement e.g. x implies y. The x condition will be determined by the biots "sense" of its environment, and y will be the behavior displayed when the x condition is met.
I have begun using my
randcat applet at a starting place. This applet was originally just one piece of code, so the greatest challenge so far have been trying to separate the applet into its environment and biot components. The environment will be the applet and the biot will be a class that will instantiate in the form of the individual biots. This was a challenge mainly because of how rusty I am with using the java library. I believe I was successful, however in the separation of the code. The moving cat is now much more simple however, its code should simply tell it to move in a specific direction. We can leave washing and napping to entities that don't need to compete to survive. The separation work was done on Nov 17, 2001.
home