SI_projekt_smieciarka/house.py
Michal Zmudzinski 5289c48fe2 Game
2021-06-13 15:14:55 +02:00

24 lines
696 B
Python

class House:
def __init__(self, position, grid_size):
self.pos = position
self.size = grid_size
def is_house(position, houses):
for house in houses:
if house.pos == position:
return True
return False
def create_houses(grid_size):
houses = []
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 == '1':
house = House(
[h_index*grid_size, l_index*grid_size], grid_size)
houses.append(house)
return houses