Showing posts with label Life simulator. Show all posts
Showing posts with label Life simulator. Show all posts

Pond life

Back in 2014 I wrote a pond life simulation in BBC BASIC for Windows and promised to share the source code.

With thanks to Ed for the prompt, I have spent the morning getting it ready and it is now available for download from my OneDrive.


In this simulation, a number of 'critters' move around a world trying to stay alive. Critters eat grass, and if they don't get enough they die. Each critter is blind and moves around randomly in the hope that they will find food or a mate (they don't have Tinder nor do they have the Tesco app).

There are a number of parameters that you can play around with, including:

  • how many critters start out;
  • how likely a critter is to die of old age or hunger;
  • how quickly the grass grows;
  • how likely two critters will breed;
  • how satisfying the grass is;
  • how many critters can be born in one 'litter';
  • and more.

This simulation is intended as a bit of fun only and I hope you enjoy it. Whilst commenting the source code I have noticed at least two places where the efficiency of the simulation is really bad. I mean REALLY BAD and massive improvements are in the pipeline.

Until then, enjoying being a pond god and I'll see you for the next geeky post which I promise will be about something.

If you want more life simulations, then you might like this post, or, who knows, even these ones.

Maybe you just want to write something on the noticeboard.

Spider webs by natural selection

I recently discovered this awesome BBC BASIC program for simulating spider webs through natural selection. It was written by Matthew Tizard for the BBC Acorn User magazine October 1992.

Natural selection left running on a BBC Master 128 for a couple of days.

The program generates nine 'spider webs'. The fittest spider web is the web that catches the most 'flies'.  This web is then chosen to go into the next generation.

Natural selection running on BeebEm with 6502 Second processor showing nine generations with 'flies' turned off.


I found that the program is best run with your second processor turned on (for hopefully obvious reasons). In fact I found that you get approximately three times improvement in speed, with one generation taking about twenty seconds to generate, draw and test on screen.

You can easily switch on your second processor using BeebEm as shown above.

Another version of the program allows you to control evolution by choosing which web you wish to survive into the next generation. In this way you can select for characteristics that you like, not necessarily the ones that will catch the most flies.

Assuming that the program is in the public domain I have put the files onto a BBC disk image which you can download from the link below.
BBC Disk Image

You will need to load the disk image into your emulator program, or directly into your microcomputer using the datacenter, MMC unit or otherwise copy it onto a floppy disk.

There is a readme file which can be loaded with *type T.readme

The programs can be executed with CHAIN "ArtAuto" OR CHAIN "ArtLife".  Press <ESCAPE> and type LIST to see the program code.


+1 Geek Experience point for Matthew Tizard

#geek #bbcmicro #naturalselection #spiderwebs

Life Simulator

Life Simulator

So I coded a life simulator. The rules: starting with about 20 critters in a world of vegetation critters can (a) move randomly each turn, (b) eat vegetation if they can, (c) reproduce if a male meets a female.


Critters can die of malnutrition and old age.  In this video you see a slow start to the colony, followed by a population explosion after about 56 seconds.  The colony dies off after it has eaten most of the vegetation available.

Source code: coming soon!

Label

World Karma Game