Coinucopia doesn't run properly

Hi there,
as it’s written in the description I start the level without changing anything in the code. But when I place a flag the hero doesn’t go to the flag. Furthermore, the hero doesn’t say anything, when I don’t place a flag. Returning to the code menu, it says “repair your code. invalid string (possibly contains a unicode character”.
How can the problem be fixed?
Cheers!

@StephHardy

  1. Which code base? Python, Javascript?
  2. Did you click “submit”, as one cannot place flags unless they are running in the submission mode.

I just ran it on Safari browser with Javascript and it works… (I reloaded the code)

  1. It’s python
  2. Yes, I pressed “Submit”, the scenery is running (coins are generated and I can place flags, but the hero just stands und doesn’t do anything)

I just copied the code. Please, don’t wonder that the instructions are in German :wink:

# Klicke "Senden" sobald du bereit bist die Flaggen zu platzieren.
# Flaggen-Buttons erscheinen links unten nach dem Klicken auf "Senden".
while True:
    flag = hero.findFlag()
    if flag:
        hero.pickUpFlag(flag)
    else:
        hero.say("Platziere die Flagge für mich, um mir den Weg zu weisen.")
    


when posting code, especially Python, you can use the “Formatted Text” button to preserve the spacing.

1 Like

So I just ran the code in Python on Safari and it worked as well…


Your code looks right… And I just finished it with Python code on my side as well. (check the top 10)

Which hero/gear are you using ?

Did you equip a “flag” to allow the code for findFlag and pickupFlag() to work?

I mean you can see something like the following in your “allowed code” area, right?

Solved!

ü is unicode and will cause the hero.say to malfunction!

so the statement:

        hero.say("Platziere die Flagge für mich, um mir den Weg zu weisen.")

is actually breaking the code.

Change it to

hero.say("Platziere die Flagge fur mich, um mir den Weg zu weisen.")

can we use “fur” instead of “für” ?

Ah yes , now it works for me, too! thank you so much!

@StephHardy Thank you for catching this.

Here is the actual code you will want:

    hero.say("Platziere die Flagge f" + '\u00FC' + "r mich, um mir den Weg zu weisen.")

Sadly this doesn’t look nice in the code though…

1 Like

That’s true.
Somebody forgot about the special characters in the German language :wink:
It’s good to see an exampel to insert special characters.
Thank you!

hero.say(“为英雄放置一面旗帜来移动.”)

also fails due to unicode issues. So I would guess that any non ASCII ? characters would be causing issues? @nick Is this a new bug? Or has unicode never worked in the hero.say() routine?

It’s probably the new Python parser. I’ll see what we can do.

2 posts were merged into an existing topic: I need support with flags

Andrew has fixed this issue:
https://discourse.codecombat.com/t/flag-problems-on-multiple-levels/18677/10?u=luke10