Compare commits

...

3 Commits

Author SHA1 Message Date
e-dt 32a917e016 Moig 3 years ago
e-dt 6cbe73c35b Merge branch 'master' of https://git.e-dt.xyz/e-dt/bodice 3 years ago
e-dt a8d342c958 OK 3 years ago
  1. 19
      main.py

19
main.py

@ -19,7 +19,7 @@ class GridSquare:
def __repr__(self):
return str(self)
def makeGrid(height, width):
def makeGrid():
return [[GridSquare(SquareType.AISLE, None) for x in range(0,width)] for y in range(0,height)]
class Passenger:
@ -51,20 +51,20 @@ def nextSquare(passenger, grid):
def GenPassList():
border = [Passenger((0, a),(-1,-1)) for a in range(0,3)]
for x in range(1,width):
border.append([Passenger((x, a),(-1,-1)) for a in range(0,3)])
border.append([Passenger((x, a),(-1,-1)) for a in range(4,7)])
border += [Passenger((x, a),(-1,-1)) for a in range(0,3)]
border += [Passenger((x, a),(-1,-1)) for a in range(4,7)]
return border
grid=makeGrid()
#boarding order
passengers = GenPassList()
for index, i in enumerate(passengers):
grid[i.curr[0]][i.curr[1]] = index
toad = 0
def tick():
global toad
# print grid
print(grid)
for row in grid:
for guy in row:
if guy.occupant is not None:
@ -74,12 +74,15 @@ def tick():
else:
print(" ", end="")
print()
if toad < len(passengers):
grid[passengers[toad].curr[0]][passengers[toad].curr[1]].occupant = toad #added
toad += 1
for (i, man) in enumerate(passengers):
#im sexist
cp = man.curr
man.curr = nextSquare(man, grid)
grid[cp[0]][cp[1]] = None #they move out of there
grid[man.curr[0]][man.curr[1]] = i
grid[cp[0]][cp[1]].occupant = None #they move out of there
grid[man.curr[0]][man.curr[1]].occupant = i
def run():
while 1:

Loading…
Cancel
Save