I cannot for the life of me spot why each row has additional leading 0's.
The array aiWalls[] defines x/y coordinates that should be a '1' in the resulting array of arrays (2 dimensional array?) wallTable[]. Any coordinates in the same wallTable[] that do not have a matching pair in aiWalls[] should be a 0.
Python:
aiWalls = [(25, 25), (25, 75), (25, 125)]
wallTable = []
tileX = 0
tileY = 0
row = []
tableSizeX = 200
tableSizeY = 200
while tileY < tableSizeY:
tileX = 0
#row = [] #new row
while tileX < tableSizeX:
pos = (tileX,tileY)
for node in aiWalls:
if node[0] == pos[0] and node[1] == pos[1]:
print("wall found @ " + str(pos))
row.append(1) #add 1 to the row
#print(row)
elif node[0] != pos[0] or node[1] != pos[1]:
row.append(0)
tileX = tileX + 25
tileY = tileY + 25
wallTable.append(row)
row = []
for scan in wallTable:
print(scan)
Output:
wall found @ (25, 25)
wall found @ (25, 75)
wall found @ (25, 125)
[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, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 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, 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]
I'm going to keep futzing with this periodically and if I solve it, I'll answer with the corrections... If you can figure it out, I would really appreciate an explanation of where I've goofed.