Does anybody know the code to Free Billy on CS2? (PYTHON)


#1

I need a code for the Free Billy challenge on CS2 (Computer Science)
This is my original code:
while True:
enemy = hero.findNearestEnemy()
if hero.isReady(“cleave”):
hero.cleave()
hero.distanceTo(enemy)
else:
if distance < 5:
hero.ta
else:
hero.attack(“Door”)

The part I’m having trouble with is the distance. BTW the language is Python


#2

you didn’t say what distance is. clarify by assigning distance with hero.distanceTo(enemy).thus, you didn’t check if the enemy exists (if statment). and, what is hero.ta?


#3

These are my directions: # Free the wild burl from the ogres!

If “cleave” is ready, then use it.

Else if the distance to an enemy less than 5, then attack it.

Else attack the “Door”.

When I try to put in elif distance < 5: it said try hero.distanceTo()


#4

oh, and format your code properly by putting in ``` twice, between the code.

but first, you have to see if the enemy exists before all that.


#5


#6

you… have… illia?


#7

Is that bad? I don’t see why


#8

how did you get it?(20)


#9

I picked it when I joined CodeCombat.


#10

how do you do that. 20


#11

I’m in a classroom for school, so when I joined it took me to a page where I had at least 6 choices of characters.


#12

And you can still change it.


#13


#14

Oh okay

you didn’t check if the enemy exists. you can’t check the distance without checking if it exists.