Use sCrypt smart contract to implement Conway's Game of Life on Bitcoin

Conway Game of Life is a fascinating zero-player game on the grid whose evolution depends on its initial state. Each generation is a pure function of the previous one.

Insert picture description here

We implemented this game on Bitcoin SV. When a Bitcoin transaction is triggered, each generation will develop into a new generation. The entire game runs completely on the chain. As long as there are transactions interacting with it, it will always live on the chain.

game rules

Any living cell with less than two living neighbors will die because of insufficient population.
Any living cell with more than three living neighbors will die because of overcrowding, so
why should the living cells of two or three living neighbors survive until Next generation,
any dead cell with exactly three living neighboring cells will be resurrected

achieve

Each generation of the game is stored as the state of the contract. We show the following parts of the implementation rules. The full contract can be found here.

Insert picture description here

Guess you like

Origin blog.csdn.net/freedomhero/article/details/111152834