Archers!


Collapse Content

Watch out for Archers, who can shoot from far...

You can check if a Space contains an Archer with Space's isArcher method. Archers will attack the explorer 3 squares away in any direction.

Range of attack of single archer (marked with x):

▥▥▥▥▥▥▥▥▥▥
▥♖...x...▥
▥....x...▥
▥....x...▥
▥.xxx↢xxx▥
▥....x...▥
▥....x...▥
▥....x...▥
▥.......☆▥
▥▥▥▥▥▥▥▥▥▥

You can store an instance variable for health to see if your current health value (from getHealth()) is less than before. Don't recharge while being attacked, since you'll just die slowly!

Don't take more than 75 moves to reach the goal.

As your code gets more complicated, it will help to create additional methods instead of keeping everything in nested if-then blocks.

Challenge

Walk, attack and recharge to reach the goal!

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us
Sign in or email us at [email protected]