-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (30 loc) · 835 Bytes
/
main.py
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
from Grid import Grid
from Game import Game
import numpy as np
# Input all parameters
# Grid dimensions
dims = input("Enter comma separated grid dimensions - width, height\n")
dims = dims.split(',')
width = int(dims[0])
height = int(dims[1])
# Intializing the grid
gen_zero = np.zeros((height, width))
# Row input
print("Enter Initial Grid")
for i in range(height):
row = input()
row = [ int(cell) for cell in row ]
gen_zero[i] = row[:]
# Cell indices
cell_idx = input("Enter comma separated cell indices\n")
cell_idx = cell_idx.split(",")
x = int(cell_idx[0])
y = int(cell_idx[1])
# Total number of cycles
cycles = input("Enter number of runs\n")
cycles = int(cycles)
grid = Grid(gen_zero)
# Initialization and game execution
game = Game(grid, cycles, y, x)
game.play()
print("Green counter: " + str(game.result()))