[Adventurer] Queue Manager

Hmmm I’m getting a bug in this level…
Whenever i do queue.pop(n)
whatever number i put in place of n, or just leave it blank, it keeps calling out the name of the last worker of the queue, instead of the first…
i did say first = queue.pop(0)
Here’s my code:
while True:
# Control the queue without mistakes.
# Useful string constants.
PHRASE_IN = " in"
PHRASE_OUT = " out"
IDLE = “idle”
# The list of workers.
workers = hero.findByType(“peasant”, hero.findFriends())
# Use this array to control the worker queue.
queue = []
# Iterate all workers:
for worker in workers:
# If the worker’s property “status” is “idle”:
if worker.status == “idle”:
# Say the free worker’s name with the word " in":
name = worker.id
hero.say(name + " in")
# Add the worker in the end of the queue:
queue.append(name)
item = hero.findNearestItem()
# If the item exists and the queue isn’t empty:
if item and queue != []:
# Say the name of the first in the queue worker
# with the word " out":
first = queue.pop()
hero.say(first + " out")
# Remove (pop) the first one from the queue

Does anyone know what is wrong with my code…?
Also, how do you incase your code so it’s separate from the rest of the message?

1 Like