SI_projekt_smieciarka/granny.py
2021-06-23 11:40:06 +02:00

14 lines
546 B
Python

class Granny:
def __init__(self, position, grid_size):
self.pos = position
self.size = grid_size
def create_granny(grid_size):
grannies = []
with open(file='houses.txt', mode='r', encoding='utf-8') as file:
for l_index, line in enumerate(file):
for h_index, if_house in enumerate(line):
if if_house == '3':
granny = Granny(
[h_index*grid_size, l_index*grid_size], grid_size)
grannies.append(granny)
return grannies