Thursday, 16 October 2014

Game of Life

Game of Life

While watching an episode of the Human Universe on BBC iplayer (http://www.bbc.co.uk/iplayer/episodes/p0276p50) the other day, Brian Cox was explaining how life and the universe is built around rules, from rivers to how Leopards get their spots, everything has simple rules. Life and indeed almost everything appears to be very complicated but he was demonstrating how a set of simple rules over time can produce very complex things.

This reminded me of one of the very first computer programs I wrote, or to be more accurate copied from a magazine, back in 1980 or 1981 which was called "Life" and devised by a British Mathematician called John Conway.

Put simply, Conway created a computer model which had a few very simple rules. Left to run for a while it would repeatedly apply these simple rules over and over again. Starting with a few random "cells" each cell would have 4 rules applied to it and over time what started with a random arrangement of cells could, and often did, arrange themselves into both simple and complex patterns. It was fascinating!

We hear a lot now about climate change, nature and our environment, and how scientists can run computer models to predict, or at least try to, the future of our actions. The game of life can be seen as a computer model running rules many times to see how the future may turn out.

The idea of applying rules over and over again is nothing new but with the Game of Life automation we can see how nature can produce complex patterns without the need for design. To me this is an important demonstration that most complex things can possibly or probably be reduced down to some basic rules. How plants grow and why they grow into the shapes they do can be seen as simply following a simple set of rules, does a cell have enough nutrients to reproduce etc. The shape it follows, a stem with a few off shoots and those off shoots split and split seems quite simple really. 

Recently I rewrote my version of "Life" and made a simple video that shows it. The cells are represented by the letter 'O' and to start Life going the program arranges a few random cells on the screen. The following rules are then applied:-

1) Any live cell with fewer than two live neighbours dies, as if caused by under-population.
2) Any live cell with two or three live neighbours lives on to the next generation.
3) Any live cell with more than three live neighbours dies, as if by overcrowding.
4) Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
5) Any cell over 40 generations old will die.

The 5th rule I added which is in addition to Conway's original set of rules. The colours are white (no cell or dead cell), black for a young cell, blue for a mature cell, and red for an old cell.

You'll need to view on full screen, and apologies for the video quality as I haven't managed to make them look that good :)






Apart from drawing a random number of cells to begin with the cells and patterns are simply generated from the basic rules mentioned above.



In the videos you can clearly see order coming from chaos and many patterns repeating. Often a symmetrical pattern of cells collides with another cell and chaos ensues. Some patterns can keep going for many generations while other groups of cells die out almost immediately. Some groups of cells walk across the screen as if they have developed legs. During the video I restart Life on many occasions and you can tell when this happens. The program also restarts automatically after 500 generations or when the cell count drops to only a few cells.

John Conway Videos





By starting the game with a different pattern, not random but one pre-chosen and by having a lot more cells  some amazing patterns can be seen. Some of them are absolutely stunning as in the following video...




Thursday, 2 October 2014

Comparing the past: October

Comparing the past: October



October 2014

October 2013

Click to enlarge pictures

Lots of changes between this year and last. Firstly, the bonfire eyesore has gone as well as the old chicken shed on the right. New vegetable beds in front of the bonfire have been created and many more fruit trees although a bit small unless you enlarge the pictures.

One of the most notable things for me is the size of the long grass. This year the grass was so much taller and thicker, so thick that it smothered the buttercups and clover. In last years photo you can clearly see the drainage channels in front of the pond but this year they are completely covered.

Another big difference is the runner beans, in front of the bonfire. Last year there were loads whereas this year the slugs got them despite repeated plantings.

This year, while cutting the paths in the long grass many many more frogs and toads have been seen which suggests that the young tadpoles have survived and are flourishing within the pond and grass. Although frogs are supposed to eat slugs the number of slugs multiplied despite the frogs and I have decided that frogs and toads are not the answer to beating slugs. The increase in good habitat for slugs and frogs, more damp hiding places, benefited slugs more than frogs. 

The new hedgehog friendly habitat created by laying down many many dead branches from and old hedge, logs and large stones, placed under the hedge on the right where the old chicken shed was hasn't produced any hedgehogs yet but it's early days I guess. I'm hoping that a family of hedgehogs may deal with some of the slugs as well as add to the diversity of life within the field.

Newts bred in the pond this year, dozens of baby newts were seen upto a month ago although the pond is now covered in duck weed and Canadian pond weed so I can't see if they are still there but the fact that tadpoles and newts were living and thriving in the same pond is good and shows that there is plenty of food for both as well as protection for tadpoles. I've only seen the Common newt this year but hopefully I'll attract some great crested newts as they are far bigger and may eat slugs.

One of things I was hoping for was that the algae would be controlled by the Canadian pond weed taking up all the nutrients but what I have seen is that regardless of the nutrient take up of the very very fast growing Canadian pond weed algae is hard to stop when there is a lot of sun hitting the water. By far the best way of dealing with algae is to reduce the sunlight as is shown by the lack of it around the Lilly pads. The flowers and plants that were supposed to provide shade around the pond simple don't help in this regard because the sun gets too high in the sky and the shading is only effective early morning as late evening. Looks like algae is here to stay since the sun hitting the water attracts many many dragonflies and damson flies and I don't want to stop that.