The comment is about checking if the item you pick is a gem with value 10.
Lets say item is the item that you check. Then you must check if item.type is "gem" and if item.value is 10. Tell me if you need more help.
Now I can’t get the coins either!!! I wonder what’s happening…could you please help me, @xantar? I have no idea how to do this-I don’t think my other lessons were as tricky as this!
you would have to chech if the item.type == gem so here is how you would put it if item.type == "gem"
the == is comparing between 2 objects. And the "" is something. Just place the item that you need in the ""
For the value part you would need to compare to see if it is == equal to whatever the value is. Do not put numbers in brackets) So this is all you need to knowfor Spring Thunder @SwordandShield
Hi Hayden, Welcome to the CodeCombat discourse.
Please could you post the code and tell us your equipment (that’s the most likely source of the error).
Thanks,
Hi, if you need help with a level please post your code (formatted, instructions here: How to Post Your Code With Radiant, Harmonious Formatting) and specify your problem so we can help you.
We won’t give you the solution, as it’s against the rules and principles of the CodeCombat discourse.
Thanks
Danny
while True:
item = hero.findNearestItem()
# A silver coin has a value of 2.
# Collect if item.type is equal to "coin"
# AND item.value is equal to 2.
if item.type == "coin" and item.value == 2:
hero.moveXY(item.pos.x, item.pos.y)
# A blue gem has a value of 10.
# Collect if item.type is equal to "gem"
# AND item.value is equal to 10.
# The hero should only grab silver coins and blue gems.
while True:
item = hero.findNearestItem()
# A silver coin has a value of 2.
# Collect if item.type is equal to "coin"
# AND item.value is equal to 2.
if item.type == "coin" and item.value == 2:
hero.moveXY(item.pos.x, item.pos.y)
pass
# A blue gem has a value of 10.
# Collect if item.type is equal to "gem"
# AND item.value is equal to 10.
if item.type == "gem" and item.value == 2:
hero.moveXY(item.pos.x, item.pos.y)
pass