Enemies!
Collapse Content
Show Content
The explorer faces many enemies...
Fighting enemies can weaken the Explorer. Call explorer.getHealth()
to check current health levels. Call explorer.recharge()
to increase health.
Don't take more than 30 moves to reach the goal.
Explorer Methods
Accessors
getSpace()
- Returns the next Space on the board.getHealth()
- returns the value ofhealth
.
Mutators
walk()
- Moves the explorer forward (to the right) one Space.poke()
- Pokes the next space, causing damage to any Enemy there.recharge()
- Adds 9 to health.
Space methods
isEnemy()
- returns true if the Space contains an Enemy, and false otherwise.
Challenge
Defeat all the enemies and reach the Goal!
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.
Comments
Kendall Ponder
Jun 18, 3:54 PMI can only poke, recharge or move once each turn. I am taking too long and dying with the same code so if I recharge less I will just die quicker or if I recharge more I will take longer. What am I missing?
Learneroo
Jun 18, 5:27 PMYou need to recharge enough to defeat the second enemy, but not too much. The Pawn had 40 energy to start off with.
Kendall Ponder
Jun 18, 6:30 PMBased on the raw output it looks like the pawn is getting recharged also.
Kendall Ponder
Jun 18, 6:31 PMThe first two pawns took 4 pokes to kill but the third one is still alive after 11 pokes.
Learneroo
Jun 18, 9:04 PM@Kendall's Explorer, never recharge while getting poked or you'll die slowly.