Explorer API
Explorer methods
Explorer can do one action per turn.
Note: walk
, getSpace
, look
and poke
can each take in a direction parameter:
- Direction.RIGHT
- Direction.LEFT
- Direction.DOWN
- Direction.UP
If no Direction is passed in, they will default to Direction.RIGHT.
Mutators / ActionsExplorer can do one action per turn.
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.
Accessors:
Note that look() and lookAround() can include null cells.look()
- Returns an Array of 3 Spaces in the designated Direction.lookAround()
- Returns an 7x7 Array of Spaces with the Explorer in the center.getSpace()
- Returns the next Space on the board.getHealth()
- returns the value ofhealth
.
Space methods
isEnemy()
- returns true if the Space contains an Enemy, and false otherwise.isKnight()
- returns true if the Space contains a Knight, and false otherwise.isArcher()
- returns true if the Space contains an Archer, and false otherwise.isWall()
- returns true if the Space contains a Wall, and false otherwise.
Knights
Collapse Content
Show Content
Conquering the world on horseback is easy; it is dismounting and governing that is hard.Genghis Khan
In this challenge, there's a new opponent - The Knight.
Knights
Knights will move towards the explorer if it's 3 moves away and attack if it's within 2 moves. You don't want to face multiple Knights at once!
Details
If the Explorer enters within 2 moves of a Knight (marked with an x
below), the Knight will attack without moving. If the Explorer enters within 3 moves, the Knight will move Up, Down, Right or Left, iff that space is unoccupied.
▥▥▥▥▥▥▥▥▥▥ ▥...U....▥ ▥..UxU...▥ ▥.LxxxR..▥ ▥Lxx♞xxR.▥ ▥.LxxxR..▥ ▥..DxD...▥ ▥...D....▥ ▥.......☆▥ ▥▥▥▥▥▥▥▥▥▥
Challenge
Pass the Knights and reach the goal!
Please sign in or sign up to submit answers.
Alternatively, you can try out Learneroo before signing up.