Poprawiono problem z generowaniem map

This commit is contained in:
Konrad Pierzyński 2019-04-01 14:32:24 +02:00
parent 7cf49721a5
commit ccb752c751
2 changed files with 11 additions and 5 deletions

View File

@ -1,5 +1,11 @@
from DataModels.Cell import Cell
from DataModels.House import House
class GC( Cell ):
def __init__( self, x, y, max_rubbish, yellow = 0, green = 0, blue = 0):
Cell.__init__(self, x, y, max_rubbish, yellow, green, blue )
Cell.__init__(self, x, y, max_rubbish, yellow, green, blue )

View File

@ -18,7 +18,7 @@ map = open(sys.argv[1], 'r')
map.readline()
map.readline()
map_objects = [ [ None for y in range(0,GRID_WIDTH)] for x in range(0, GRID_HEIGHT)]
map_objects = [ [ None for y in range(0,GRID_HEIGHT)] for x in range(0, GRID_WIDTH)]
def generate( letter ):
key = 'D' if letter in ['B','G','Y'] else letter
@ -34,9 +34,9 @@ def generate( letter ):
i = 0
for y in map.readlines():
for x in y.split():
y_coord = i % GRID_WIDTH
x_coord = (i - y_coord)//GRID_WIDTH
x_coord = i%GRID_WIDTH
y_coord = (i-x_coord)//GRID_WIDTH
yellow, green, blue = [randint(0, HOUSE_CAPACITY //2),randint(0, HOUSE_CAPACITY //2),randint(0, HOUSE_CAPACITY //2)]
if x is 'E':