# Proposal to modify the rules of the game Life

Good reading time, dear Habr users! The game Life was proposed by John Conway in 1970, and was repeatedly discussed at habrahabr.ru. The main tags used are listed in the tags for this article.

A number of changes are proposed that can lead to a new direction in development.

Proposition 1. In the original game, an infinite field is proposed, however, the implementation usually uses the torus sweep rule — the horizontal and vertical are closed in cycles.

A variant is proposed in which the horizontals of a rectangular field of finite size are closed into a cylinder, and the verticals are paired in steps of half the size of the field horizontally. Thus, it is possible to obtain an analog of the sphere that is easy to calculate.

To simulate isotropy, it is proposed to use a triangular grid, which in the calculations is replaced by an estimate of the horizontal, vertical, and one of the diagonals.

Horizontal layers can be used to change the environment:

one layer at a height of 20% at the equator - with good living conditions (3-4 neighbors for conservation, 4 for nucleation)

two layers of 10% each - with poor living conditions (1-2 neighbors for conservation , 2 - for the birth of life)

for the rest of the usual rules apply (2-3 neighbors to save, 3 - for the birth of life)

Proposition 2. For organisms, it is proposed to add levels of complexity, possibilities of association, genetic modification and training. Each organism is assigned up to 10 levels of complexity, each level is represented both in the material and in the abstract field.

The level of complexity in the material field affects the maximum speed (the number of cells that the body moves in one direction in one turn). Thus, organisms with the first level of complexity (array index 0) are motionless. The whole organism moves in its entirety.

The level of complexity in the abstract area affects the number of neighboring cells viewed in a straight line. It offers a doubled compared with the ability to move the viewing radius: for the first level - 1, for the second level - 3, etc. Visibility is determined from the most extreme cells of the body.

The implementation of such games may be of interest to modern students studying big data processing and learning algorithms. There is currently no own implementation option.

Genetic evolution of supreme algorithm algorithms recommended

Upd: option in the context of tunnel modeling complexity groups https://habrahabr.ru/post/259291/ :

in the context of natural systems

probabilistic inference (Bayes) - chaotic

genetic search (evolution) - fractal

optimization with limitations (analogies) - energy

reverse deduction (symbolists) - informational

gradient descent (connectionists) - static

then the systems begin to exhibit behavior, and the chain repeats at the level of the living:

probabilistic inference (Bayes) - dynamic (processes)

genetic search (evolution) - synergetic (market)

optimization with limitations (analogies) - corporate (childbirth)

reverse deduction (symbolists) - bureaucratic (regulations)

gradient descent (connectionists) - environmental

References: Pedro Domingos, Supreme Algorithm. How machine learning will change our world.

Links:

https://habr.com/en/post/435670/ - Supreme algorithm - distribution of algorithms by difficulty level

**Python option**

Python

source : life.py

```
import pygame
import field
import numpy as np
running = True
v = field.area()
step=0
pygame.init()
screen = pygame.display.set_mode([640, 550])
font = pygame.font.Font(None, 50)
while running:
screen.fill([0, 0, 0])
clr = 0
for r in range(1, v.height):
for c in range(1, v.width):
if v.val[r, c] != 0:
clr=clr+64
if r % 2 == 0 and c % 2 == 0:
if clr > 255:
clr = 255
screen.set_at([r/2, c/2], [clr, clr, clr])
clr = 0
step_text = font.render(str(step),1, (255, 255, 0))
screen.blit(step_text, [10, 520])
pygame.display.flip()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
v.generate()
step=step+1
pygame.quit()
print "Done"
```

field.py

```
import numpy as np
import random
class area:
def __init__(self):
self.width = 1000
self.height = 1000
self.debug = False
self.val = np.zeros((self.height, self.width), dtype = int)
self.val1 = np.zeros((self.height, self.width), dtype = int)
self.val[250, 140] = 1
self.val[250, 141] = 1
self.val[251, 140] = 1
self.val[251, 141] = 1
self.val[252, 140] = 1
self.val[252, 141] = 1
self.rw = range(1, self.width-2)
self.rh = range(1, self.height-2)
self.r3 = range(-1, 2)
self.dh = int(self.height/10)
self.h1 = [self.dh*2, self.height-self.dh*2]
self.h2 = [self.dh, self.height-self.dh]
def generate(self):
for cnt in self.r3:
c = random.randint(0, self.width-1)
r = random.randint(0, self.height-1)
self.val[r, c] = 1
c = random.randint(0, self.width-1)
r = random.randint(0, self.height-1)
self.val[r, c] = 0
for c in self.rw:
for r in self.rh:
self.val1[r, c] = 0
cnt = 0
for r1 in self.r3:
for c1 in self.r3:
if not ((r1 == 0) and (c1 == 0)) and not (r1==-1 and c1==1) and not (r1==1 and c1==-1):
if self.val[r+r1, c+c1] != 0:
cnt = cnt + 1
self.val1[r, c] = self.store_value(c, cnt, self.val[r, c])
for r in self.rh:
for c in self.rw:
self.val[r, c] = self.val1[r, c]
for c in self.rh:
if self.val[c, self.width-2] == 1:
self.val[0, c] = self.val[self.width-2, c]
if self.val[1, c] == 1:
self.val[self.width-1, c] = self.val[2, c]
def store_value(self, c, cnt, cur):
val = 0
if self.h1[0] < c < self.h1[1]:
if 1 <= cnt <= 4:
val = 1
if cur == 1 and cnt < 3:
val = 1
else:
if self.h2[0] < c < self.h2[1]:
if 2 <= cnt <= 3:
val = 1
if cur == 1 and 2 <= cnt <= 3:
val = 1
else:
if cnt == 2:
val = 1
if cur == 1 and 1 <= cnt <= 2:
val = 1
return val
```

Result: