Error with "Forest Siege" Level - Code Execution Timeout

Hi everyone,

I am facing an issue with the “Forest Siege” level in CodeCombat. My code runs fine in the initial stages, but it consistently times out during the later stages of the level. Here are the details:

Level: Forest Siege
Issue: Code execution timeout

Steps to Reproduce:
Start the “Forest Siege” level.

Use the following code to control the hero:

while True:
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
else:
hero.moveXY(40, 34)

Run the code and observe the execution.

The hero should continue attacking enemies and proceed to the next stages without timing out ; but the code times out after a few waves of enemies, making it impossible to complete the level.

I am using ; Browser: Chrome 91.0
Operating System: Windows 10

I have tried optimizing the code, but the issue exist . Clearing the cache and cookies did not resolve the problem either.
I have referred Bugs - CodeCombat Discourse flutter guide but didn’t find a solution to my problem.

Has anyone else experienced this issue? Any suggestions for a workaround or a fix would be greatly appreciated.

Thanks in advance!

Best regards,
gregbowers

Hi Greg! Thanks for sharing your code.

Could you please send a screenshot of your equipment and hero?

Cheers

Edit: Here’s a formatted version of your code so that it’s easier for me to help you

while True:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
    else:
        hero.moveXY(40, 34)
1 Like