New save file format

pull/2/head
Micke Nordin 7 years ago
parent fa5fd85067
commit a2072327d9

@ -1,21 +1,30 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0 000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

@ -6,7 +6,7 @@ import time
class Board(): class Board():
# Board should be a n x n matix of cells that describes a flat torus # Board should be a n x m matix of cells that describes a flat torus
def __init__(self, cells=None): def __init__(self, cells=None):
if cells is None: if cells is None:
self.cells = self.from_file("board.txt") self.cells = self.from_file("board.txt")
@ -32,7 +32,7 @@ class Board():
for row in self.save_file: for row in self.save_file:
board.append([]) board.append([])
cellc = 0 cellc = 0
for cell in row[:-1].split(','): for cell in row[:-1]:
board[rowc].append( Cell(rowc,cellc,bool(int(cell))) ) board[rowc].append( Cell(rowc,cellc,bool(int(cell))) )
cellc = cellc + 1 cellc = cellc + 1
rowc = rowc + 1 rowc = rowc + 1
@ -91,12 +91,6 @@ class Cell:
else: else:
return " " return " "
def kill(self):
self.alive = False
def hatch(self):
self.alive = True
class MooreN: class MooreN:
# Moore Neighbourhood is all eight cells surrounding a central cell # Moore Neighbourhood is all eight cells surrounding a central cell
@ -138,7 +132,7 @@ board = Board()
while True: while True:
print("\033[H\033[J") print("\033[H\033[J")
print(board) print(board)
time.sleep(0.3) time.sleep(0.1)
board = board.next_gen() board = board.next_gen()

Loading…
Cancel
Save