I made a recursive bisecting maze algorithm in just eight lines of code. (click on above image to see it in action)
The efficiency of the algorithm comes at the cost of a fairly low entropy. It means that the randomness of the maze is limited. A high entropy algorithm could ideally produce a maze where you had to traverse every room in the labyrinth in order to move from the room in the bottom left corner to the room to it’s immediate right. This could never be the case with the above listed bisecting algorithm where internal access between rooms within the same bisection is always guarantied.
One of the most fascinating aspects of Game of Life is that it illustrates so well how a completely deterministic process can be so unpredictable. Use a fixed starting pattern and run. Watch the result. Use the same starting pattern but change a single cell somewhere. The new result can be as different from the old as night and day.
Absolute determinism plus unpredictability are precisely the two things you look for in a hash algorithm. When you store passwords on a server you don’t store the passwords themselves but their hashes, calculated using some hash algorithm like for example MD5, SHA-256 or Whirlpool.
A user authenticating himself on the server inputs his password and the server hashes the password to see if the hash corresponds to the hash stored on the server.
For a hacker getting hold of the stored hashes, or for the system administrator, there is no way to run the hash algorithms backwards to retrieve the real passwords. The only way to break a hash is to systematically hash every possible password (out of zillions) and see if the hash matches.
Try to hash different words or sentences differing only by a single letter adjacent in the alphabet and watch how the hash value changes. You can also try to hash some text but before you click on the ”Run 200 steps” click somewhere on the gird with the mouse pointer to change a single bit.
A lot of people are familiar with British mathematician John Horton Conway’s ”Game of Life” – an algorithm to simulate cellular growth and decay, first published in Scientific American in 1970.
The concept is simple. Imagine an infinite grid of empty squares. Each of these squares can either be empty or occupied by a ”cell”. The are only two rules. One rule for empty squares (the birth rule) and one rule for squares occupied by a cell (the survival rule).
Birth: If an empty square has exactly three neighboring cells a new cell is born in that square.
Survival: An existing cell will only survive if it has either two or three neighbors.
These two rules implies a time axis along which the grid will project forward in discrete phases.
But why do we have these specific rules? Why is exactly three neighbors required to give birth to a new cell?
Conway’s classical rules are sometimes abbreviated to the code B3/S23.
The reason for these particular rules to have become so popular isn’t that strange. Anyone who has experimented with a simulation engine using these rules knows that they often create very complex and interesting situations.
But this being a fact doesn’t exclude the possibility of other rules also having the potential of creating complex and interesting scenarios.
Conway himself and others have explored a lot of other possible rules for Birth and Survival.
I dealt with this question systematically and found out that there are only 36 symmetrical shapes out of a total of 37888 that will grow indefinitely. All the other symmetrical 8×8-shapes will eventually be either totally annihilated or get stuck in small for ever repeating loops of shapes (so called pulsars).
Here is the total set of miracle seeds – the smallest possible symmetrical shapes that I found that will grow forever. All the tens of thousands of others are destined to perish or stagnate.
I have shown that there exist no smaller symmetrical shapes, for example 7×7-shapes or 6×6-shapes, that will grow indefinitely.
Add or remove a single pixel anywhere and they will die – that’s how sensitive they are (try it out for yourself).
So these are the symmetrical ones. What about the asymmetrical ones?
I don’t know, but I guess that you can’t find an asymmetrical shape smaller that 8×8 that will grow indefinitely.
It could be tested systematically but the number of all shapes that occupy a maximum space of 8 times 8 squares are much larger than just the symmetrical ones.
Click on this link or on the picture above to go to my B345/S45 simulation engine.
Update: July 28 2015
Amazing news. After seventeen hours of automatic testing of random shaped populations eight different asymmetric 8×7 indefinite growers presented themselves!
I also found three shapes that lasted a long time but in the end didn’t quite make it.
They lasted 539, 542 and 716 (!) rounds respectively.
I’m very pleased with the result because I think they play really well. You play the foxes and you can chose to face sheep of four levels of difficulty. It’s not that hard to beat them at the two easier ”lamb-levels” but try to beat them on any of the two more advanced levels. Can you do that? Click on [this link] or on the picture above to play!