|
@ -1,4 +1,9 @@ |
|
|
#/usr/bin/env python3 |
|
|
#!/usr/bin/env python3 |
|
|
|
|
|
from enum import Enum |
|
|
|
|
|
class SquareType(Enum): |
|
|
|
|
|
AISLE = 0 |
|
|
|
|
|
SEAT = 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
height=7 |
|
|
height=7 |
|
|
width=33 |
|
|
width=33 |
|
@ -7,9 +12,11 @@ class GridSquare: |
|
|
def __init__(self, typ, occupant): |
|
|
def __init__(self, typ, occupant): |
|
|
self.typ = typ |
|
|
self.typ = typ |
|
|
self.occupant = occupant |
|
|
self.occupant = occupant |
|
|
|
|
|
def __str__(self): |
|
|
|
|
|
return "(%s|%s)" % (str(typ), str(occupant)) |
|
|
|
|
|
|
|
|
def makeGrid(): |
|
|
def makeGrid(): |
|
|
return [[GridSquare(0, 0) for x in range(0,height)] for y in range(0,width)] |
|
|
return [[GridSquare(SquareType.AISLE, 0) for x in range(0,width)] for y in range(0,height)] |
|
|
|
|
|
|
|
|
class Passenger: |
|
|
class Passenger: |
|
|
#dest and curr are both 2-tuples |
|
|
#dest and curr are both 2-tuples |
|
@ -17,6 +24,16 @@ class Passenger: |
|
|
self.dest = dest |
|
|
self.dest = dest |
|
|
self.curr = curr |
|
|
self.curr = curr |
|
|
|
|
|
|
|
|
|
|
|
def manhattanDistance(pos1, pos2): |
|
|
|
|
|
return abs(pos1[0] - pos2[0]) + abs(pos1[1] - pos2[1]) |
|
|
|
|
|
|
|
|
|
|
|
def mooreNeighbourhood(pos): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def nextSquare(passenger, grid): |
|
|
|
|
|
#simple behaviour for now |
|
|
|
|
|
for i in |
|
|
|
|
|
|
|
|
def GenPassList(): |
|
|
def GenPassList(): |
|
|
return [] |
|
|
return [] |
|
|
|
|
|
|
|
@ -24,4 +41,8 @@ grid=makeGrid() |
|
|
|
|
|
|
|
|
passengers = GenPassList() |
|
|
passengers = GenPassList() |
|
|
|
|
|
|
|
|
print(grid) |
|
|
def tick(): |
|
|
|
|
|
# print grid |
|
|
|
|
|
print(grid) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|