17 lines
507 B
Python
17 lines
507 B
Python
import random
|
|
from house import is_house
|
|
|
|
|
|
class Trash:
|
|
def __init__(self, grid_w, grid_h, grid_size):
|
|
self.grid_w = grid_w
|
|
self.grid_h = grid_h
|
|
self.size = grid_size
|
|
|
|
def new_pos(self, truck_pos, houses):
|
|
while True:
|
|
self.pos = [random.randrange(0, self.grid_w, self.size),
|
|
random.randrange(0, self.grid_h, self.size)]
|
|
if self.pos != truck_pos and not is_house(self.pos, houses):
|
|
break
|