Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Help Needed: Decoy Drill - Python


May I ask why does Anya walks straight to Naria to report decoysBuilt? Will appreciate it if you could help me point out my problem.
Below is my code. :innocent:

We are field testing a new battle unit: the decoy.

Build 4 decoys, then report the total to Naria.

decoysBuilt = 0 = 0

item = self.findNearestItem()
# Loot the coin!
x = item.pos.x
y = item.pos.y
self.moveXY(x, y)
# Each decoy costs 25 gold. Use the Quartz Sense Stone
# to know when you have more than 25 gold with += item.value
if >=25:
self.buildXY(“decoy”, self.pos.x - 5, self.pos.y)
# Keep a count of decoys you built as you go along.
decoysBuilt = decoysBuilt +1
# Break out of the loop when you have built 4.
elif decoysBuilt = 4:

Go to Naria and say how many decoys you built.

    self.moveXY(14, 36)    


Use elif decoysBuilt == 4, with double ==, not =. == is equality test, = is assignment. (Programming is weird.)

Also, in this one, you don’t assign to You just read from it–the Quartz Sense Stone keeps track of your gold for you, unlike the previous level. You just keep track of how many decoys you have built.


Thank you for the clarification (about “=/==”) but I solved the level using the hard way already :smiley: