-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconwayText.py
More file actions
executable file
·50 lines (45 loc) · 1.03 KB
/
conwayText.py
File metadata and controls
executable file
·50 lines (45 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/local/bin/python3
from time import sleep
from conway import Conway
MAX_ROWS = 40
MAX_COLUMNS = 80
# MAX_ROWS = 9
# MAX_COLUMNS = 9
# DRAW_BOARD = 0
# BUFFER_BOARD = 1
# boards[DRAW_BOARD] = [
# 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,
# 0,0,0,1,1,1,0,0,0,
# 0,0,0,1,1,1,0,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,0,0,0
# ]
# boards[BUFFER_BOARD] = [
# 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,
# 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,
# 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
# ]
conwayGame = Conway(MAX_COLUMNS, MAX_ROWS)
def draw():
"Draw the baord."
global conwayGame
for y in range(MAX_ROWS):
for x in range(MAX_COLUMNS):
print( ' ' if conwayGame.getCell(x, y) == 0 else 'X', end='')
#print('(x, y, v) (', x, ',', y, ',', boards[DRAW_BOARD][y*MAX_COLUMNS + x], ')')
print('')
print( ''.join(['-' for x in range(MAX_COLUMNS)]) )
while True:
draw()
conwayGame.tick()
sleep(0.5)