Add randomly change the plate from full to empty
This commit is contained in:
parent
6d4744f553
commit
df0bf3207c
9
main.py
9
main.py
@ -55,14 +55,16 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
plateArr = []
|
plateArr = []
|
||||||
|
|
||||||
|
|
||||||
def changePlate():
|
def changePlate():
|
||||||
if plateArr and len(plateArr) > 0:
|
if plateArr and len(plateArr) > 0:
|
||||||
if randrange(30) == 17:
|
if randrange(30) == 17:
|
||||||
plate = random.choice(plateArr)
|
plate = random.choice(plateArr)
|
||||||
if not plate.empty:
|
if not plate.empty:
|
||||||
randomPlate = randrange(5)+10
|
randomPlate = randrange(5) + 10
|
||||||
plate.changePlate('plate-empty.png', 'test-{}'.format(randomPlate))
|
plate.changePlate('plate-empty.png', 'test-{}'.format(randomPlate))
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
changePlate()
|
changePlate()
|
||||||
|
|
||||||
@ -125,7 +127,7 @@ if __name__ == "__main__":
|
|||||||
print(plateArr, pltPos)
|
print(plateArr, pltPos)
|
||||||
|
|
||||||
goal = (plateArr[len(plateArr) - 1].table[0], plateArr[len(plateArr) - 1].table[1])
|
goal = (plateArr[len(plateArr) - 1].table[0], plateArr[len(plateArr) - 1].table[1])
|
||||||
randGo = len(plateArr)-1
|
randGo = len(plateArr) - 1
|
||||||
path = waiter.findPath(goal)
|
path = waiter.findPath(goal)
|
||||||
path = waiter.translatePath(path)
|
path = waiter.translatePath(path)
|
||||||
print('sec-2')
|
print('sec-2')
|
||||||
@ -182,7 +184,7 @@ if __name__ == "__main__":
|
|||||||
path = waiter.translatePath(path)
|
path = waiter.translatePath(path)
|
||||||
|
|
||||||
# Dominik
|
# Dominik
|
||||||
if path == '' and fromBar == 0 and check == 1:
|
if path == '' and fromBar == 0 and check == 1:
|
||||||
task = queue.pop(0)
|
task = queue.pop(0)
|
||||||
tree.RemoveTask()
|
tree.RemoveTask()
|
||||||
node = (task[2][0], task[2][1])
|
node = (task[2][0], task[2][1])
|
||||||
@ -200,7 +202,6 @@ if __name__ == "__main__":
|
|||||||
path = waiter.translatePath(path)
|
path = waiter.translatePath(path)
|
||||||
fromBar = 0
|
fromBar = 0
|
||||||
|
|
||||||
|
|
||||||
if path != '':
|
if path != '':
|
||||||
nextStep = path[0]
|
nextStep = path[0]
|
||||||
path = path[1:]
|
path = path[1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user