almost nothing done
This commit is contained in:
parent
2ff5d0f1ca
commit
bf442c94bf
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
import time
|
||||||
|
|
||||||
GRIDSIZE = 300
|
GRIDSIZE = 300
|
||||||
INIT_CELLS = int(GRIDSIZE*0.1)
|
INIT_CELLS = int(GRIDSIZE*0.1)
|
||||||
@ -16,6 +17,12 @@ def get_distance(grid, i):
|
|||||||
"""
|
"""
|
||||||
Insert your code here
|
Insert your code here
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if i == GRIDSIZE-1:
|
||||||
|
dist = (grid[i], grid[0])
|
||||||
|
else:
|
||||||
|
dist = (grid[i], grid[i+1])
|
||||||
|
|
||||||
return dist
|
return dist
|
||||||
|
|
||||||
# state transition t -> t + dt
|
# state transition t -> t + dt
|
||||||
@ -23,6 +30,12 @@ def update(grid_old, grid_new):
|
|||||||
for i in range(GRIDSIZE):
|
for i in range(GRIDSIZE):
|
||||||
dist = get_distance(grid_old, i)
|
dist = get_distance(grid_old, i)
|
||||||
|
|
||||||
|
if not -1 in dist:
|
||||||
|
dist = dist[1] - dist[0]
|
||||||
|
|
||||||
|
print(dist)
|
||||||
|
time.sleep(0.5)
|
||||||
|
|
||||||
""" Update cars according rules using value 'dist' """
|
""" Update cars according rules using value 'dist' """
|
||||||
"""
|
"""
|
||||||
Insert your code here
|
Insert your code here
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user