From f6f546de9519a736ec886a4389163474b65a85e4 Mon Sep 17 00:00:00 2001 From: EtherealEntity Date: Wed, 23 Mar 2022 11:40:24 +1100 Subject: [PATCH 1/3] tick counter. final tick print. tick modulator. --- main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index d5a7e64..dc53496 100644 --- a/main.py +++ b/main.py @@ -73,11 +73,12 @@ grid=makeGrid() passengers = GenPassList(grid) toad = 0 +btime = 10 #passengers board every btime ticks - -def tick(): +def tick(t): done=True global toad + global btime # print grid for row in grid: for guy in row: @@ -89,7 +90,7 @@ def tick(): print(".", end="") print() print("---") - if toad < len(passengers): + if toad < len(passengers) and t % btime == 0: grid[3][0].occupant = toad #added passengers[toad].curr = (3, 0) toad += 1 @@ -105,10 +106,13 @@ def tick(): grid[cp[0]][cp[1]].occupant = None #they move out of there grid[man.curr[0]][man.curr[1]].occupant = i if done: + print("Final Tick: " + t); exit() def run(): + t = 0 while 1: - tick() + t += 1 + tick(t) run() From 2ee0911312ae403aa48f0165ffd563b005c0d0e8 Mon Sep 17 00:00:00 2001 From: EtherealEntity Date: Wed, 23 Mar 2022 11:40:59 +1100 Subject: [PATCH 2/3] whoops cast int to str --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index dc53496..23a116d 100644 --- a/main.py +++ b/main.py @@ -106,7 +106,7 @@ def tick(t): grid[cp[0]][cp[1]].occupant = None #they move out of there grid[man.curr[0]][man.curr[1]].occupant = i if done: - print("Final Tick: " + t); + print("Final Tick: " + str(t)); exit() def run(): From eef796b2c6109c2779758059c1ca6c8bc0018e96 Mon Sep 17 00:00:00 2001 From: EtherealEntity Date: Wed, 23 Mar 2022 11:43:13 +1100 Subject: [PATCH 3/3] moved tick modulator so it WORKS. --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 23a116d..3871198 100644 --- a/main.py +++ b/main.py @@ -105,14 +105,14 @@ def tick(t): man.curr = nextSquare(man, grid) grid[cp[0]][cp[1]].occupant = None #they move out of there grid[man.curr[0]][man.curr[1]].occupant = i - if done: + if done and toad >= len(passengers): print("Final Tick: " + str(t)); exit() def run(): t = 0 while 1: - t += 1 tick(t) + t += 1 run()