The two flowers problem


#1

I am trying to finish the level but I cant because it keeps saying “dont know how to transform “Set”” here is my code

def summonSoldiers():
if hero.gold >= hero.costOf(“soldier”):
hero.summon(“soldier”)

Define the function: commandSoldiers

def commandSoldiers():
friend = hero.findFriends()
enemy = hero.findNearestEnemy()
soldiers = hero.findByType(“soldier”)
peasant = hero.findByType(“peasant”)
x = peasant.pos.x
y = peasant.pos.y
for soldier in soldiers:
hero.command(soldier, “defend”, {x, y})

Define the function: pickUpNearestCoin

def pickUpNearestCoin():
item = hero.findNearestItem()
if item:
hero.move(item.pos)
while True:
summonSoldiers()
commandSoldiers()
pickUpNearestCoin()


#2

Please learn to post your code properly. It’s really easy and only requires a very small amount of effort.

To post your code from the game, use the </> button or it won’t format properly. When you click the </> button, the following will appear:

Please paste ALL of your code inside the triple back tick marks.

``` <— Triple back tick marks.

Paste ALL of your code in here.

``` <— Triple back tick marks.

There are many people here willing and able to help. If you use the </> button correctly, then ALL of your code should look like this:

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    else:
        hero.say("My code is formatted properly")

If ALL of your code isn’t formatted like the code above, then you’re doing it wrong and we can’t see the structure of the code to troubleshoot whether or not that is the issue. Use the </> button and help us help you. This works when sending a private message as well.

Thank you.


#3

Welcome to codecombat discourse! This is a cozy place where you can ask for help, get hints, and maybe just have fun! Before you proceed, we want you to review this topic.

And if you need any assistance, feel free to ask the staff!
Enjoy your time in this forum!


#4

where does it say the “set” is?