The Game of Life, or just ā€˜Lifeā€™ for short, was created by John Conway, a British mathematician, back in 1970. Its name can be deceiving because itā€™s not what most would call a game. You donā€™t really play it in the traditional sense. Instead, you set it up initially and then just watch how it unfolds on its own. You start by setting up some initial patterns and then see how they evolve over time. Whatā€™s cool about it is that itā€™s Turing complete, meaning it can perform some pretty complex computations, like running a calculator or even ChatGPT.

Hereā€™s what it looks like:

0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

The game runs on a two-dimensional board. Each cell is either ALIVE (black in the image above) or DEAD (white in the image above). The game progresses in steps. At each step, based on simple rules, cells can come to life, or they can die. There are actually just four rules:

  1. Lonely Cells Donā€™t Survive: If a cell has fewer than two neighbors around, it gets lonely and doesnā€™t make it.
  2. The Sweet Spot of Friendship: If a cell has two or three neighbors, itā€™s in the perfect social circle. Not too crowded, nor too lonely. Just the right amount of friends to keep going strong.
  3. Too Many Friends, Too Much Drama: Now, if a cell has more than three neighbors, itā€™s like being in a super crowded place. Too many people, too much drama, and our cell just canā€™t handle it. It gets overwhelmed and, well, itā€™s game over for that cell.
  4. The Magic of Three for New Beginnings: Imagine a cell thatā€™s not active (like itā€™s taking a nap). If exactly three active cells come around it, they wake it up! Itā€™s like having three friends come over and say, ā€œHey, join the party!ā€ And the cell is back in the game, ready to live it up.

With just those simple rules, very complex behavior emerges. If you believe we will reach AGI someday, it could even demonstrate intelligence.

Life Collection

I have been fascinated by this game for over ten years. The other day, I was in the swimming clubā€™s locker room when the idea struck me: each ā€˜Lifeā€™ seed is a world of its own.

There are an infinite number of possible seeds. Some of them create very interesting patterns, while others just disappear in a couple of steps. What if we could catalog all the interesting patterns and name them? Similar to what scientists do with stars and constellations. What if you could own the game of life? People would discover patterns that please them, catalog them, and name them. We could crowdsource the cataloging of interesting patterns.

This idea excited me a lot. Could we start a new trend: extending the notion of digital ownership to the mathematical domain? Could you own mathematical objects? We could create a new appreciation for those objects and ā€œturn them into concrete things.ā€ So, I rolled up my sleeves and started creating Life Collection, a mathematical NFT.

Representing a Seed in the Smart Contract

To reduce the scope of the project, we are only dealing with finite seeds. A seed could be represented as an N x N matrix, where N is the number of columns. Each cell has a 1 for a live cell and a 0 for a dead cell. Hereā€™s an example seed:

0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

Storing data on the blockchain is expensive, so creating an array of arrays of numbers would be unnecessarily costly. Instead, what I did was to first concatenate all zeros and ones into a single vector. Each line is concatenated with the next one like so:

0000000000000000000100000000100000111000000000000000000000000000

Next, I simply convert that string to a binary number, so with an uint64 we can store an 8 x 8 seed:

17627485306880

Want to see it live? You can play around on the editor right now to see what number each seed is converted to.

The Advantages of This Approach

There are a couple of advantages to doing it this way:

  • Compactness and ease of uniqueness verification: Comparing matrices is cumbersome and costly. Comparing numbers is easy. Saving computation almost always pays off when creating smart contracts.
  • Storing minted seeds for transparency and uniqueness: Itā€™s easy to check for unique seeds and whether a seed was already minted.

Do you want to own these marvelous mathematical constructs? Follow me on x.com and on friend.tech where I post the latest news about this and all my projects!