Rectangles of width 2row in Python 3, +2
The shape of this grid is as follows:
______________ [______________] [______][______] [__][__][__][__] [][][][][][][][]
Coincidentally, each cell in this grid has 8 neighbors, just like the original square tiling of the Game of Life.
Unfortunately, this tiling has the terrible property that each cell only has two north neighbors. That means a pattern can never propagate southward, including southeast or southwest. This property leads to a situation that makes oscillators virtually impossible. If there are any gliders, they will not travel southward, and probably not directly east or west either. I have hope of there existing a northwest or northeast glider, but have not been able to find it.
That leaves us with a measly +2 bonus for a wide variety of still lifes, of which these are only a small sample:
AA__ _BC_ AABB _CD_ AA__BB _CXXD_ <-- XX can be any multiple of 2 wide ____YYYY____ __AA____BB__ ___CXXXXD___ <-- XX can be any multiple of 4 wide ____YYYYOOOO <-- OOOO can continue to the right and could be the bottom of a stack of this pattern __AA____BB__ ___CXXXX____ <-- XX can be any multiple of 4 wide OOOOYYYYOOOO <-- same stackability as above __AA____BB__ ____XXXX____ <-- XX can be any multiple of 4 wide
Here is the code, which when run will draw an 8-row grid (1 cell in the top row, 128 cells in the bottom row). Any key will advance one step, except r will randomize the board and q will exit the program.
#!/usr/bin/env python3 import random import readchar class board: def __init__(self, rows = 8): if rows>10: raise ValueError("Too many rows!") self.rows = rows self.cells = [[cell() for c in range(int(2**(r)))] for r in range(rows)] def __str__(self): out = [] for r,row in enumerate(self.cells): out.append(''.join([str(row[c])*(2**(self.rows-r-1)) for c in range(len(row))])) return "\n".join(out) def randomize(self): for row in self.cells: for c,cel in enumerate(row): row[c].state = random.choice([True,False]) def state_at(self,r,c): if r==None or c==None: raise TypeError() if r<0 or c<0: return False if r>=self.rows: return False if c>=len(self.cells[r]): return False return self.cells[r][c].state def tick(self): new_cells = [[cell() for c in range(int(2**(r)))] for r in range(self.rows)] for r,row in enumerate(self.cells): for c,cel in enumerate(row): # print(f"cell {r} {c}") cur = cel.state # print(cur) neighbors = 0 # same row, left and right neighbors += self.state_at(r,c-1) neighbors += self.state_at(r,c+1) # straight up neighbors += self.state_at(r-1,int(c/2)) # straight down neighbors += self.state_at(r+1,c*2) neighbors += self.state_at(r+1,c*2+1) # down left neighbors += self.state_at(r+1,c*2-1) # down right neighbors += self.state_at(r+1,c*2+2) if c%2==0: # up left neighbors += self.state_at(r-1,int(c/2)-1) else: # up right neighbors += self.state_at(r-1,int(c/2)+1) # print(neighbors) if cur: if neighbors<2 or neighbors>3: # print("turn off") new_cells[r][c].state = False else: new_cells[r][c].state = True continue if neighbors==3: # print("turn on") new_cells[r][c].state = True continue new_cells[r][c].state = False continue self.cells = new_cells class cell: def __init__(self, state = False): self.state = state def __str__(self): return self.state and "X" or "_" b = board(8) b.randomize() print(b) while(1): i = readchar.readchar() if i=='q': break if i=='r': b.randomize() b.tick() print() print(b)
PS: This grid is the equivalent of regular in a particularly shaped non-Euclidean space :)