diff --git a/main.py b/main.py index d5a7e64..2878c22 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ #(height, width) import random as rnd from enum import Enum +import time class SquareType(Enum): AISLE = 0 @@ -72,9 +73,16 @@ grid=makeGrid() #boarding order passengers = GenPassList(grid) +import random +random.seed(505) +random.shuffle(passengers) toad = 0 +import os +def nunty(x): + if x is None: return -1 + return x def tick(): done=True global toad @@ -82,14 +90,15 @@ def tick(): for row in grid: for guy in row: if guy.occupant is not None: - print("X", end="") + print(chr(0x4e00 + guy.occupant), end="") elif guy.typ == SquareType.SEAT: - print("_", end="") + print(":", end="") else: - print(".", end="") + print("。", end="") print() print("---") - if toad < len(passengers): + print(grid[3][0].occupant, grid[3][1].occupant, passengers[nunty(grid[3][1].occupant)].dest) + if toad < len(passengers) and grid[3][0].occupant is None: grid[3][0].occupant = toad #added passengers[toad].curr = (3, 0) toad += 1 @@ -98,12 +107,19 @@ def tick(): continue if man.curr == (-1, -1): continue + if i == 36: + print(nextSquare(man, grid)) done=False #im sexist cp = man.curr man.curr = nextSquare(man, grid) - grid[cp[0]][cp[1]].occupant = None #they move out of there + other = grid[cp[0]][cp[1]] + other.occupant = grid[man.curr[0]][man.curr[1]].occupant #they move out of there + if other.occupant is not None: + passengers[other.occupant].curr = cp grid[man.curr[0]][man.curr[1]].occupant = i + time.sleep(0.1) + os.system("clear") if done: exit()