Knights and Archers
They are in front of us, behind us, and we are flanked on both sides by an enemy that outnumbers us. They can't get away from us now!
What if the board was larger and with more enemies? If your code is general enough, you shouldn't need to change much, and the lone
explorer should be able to defeat all the enemies!
You can use the Space methods
isArcher() to check if a Space contains a specific enemy.
poke can each take in a direction parameter (either Direction.RIGHT or Direction.LEFT). If no Direction is passed in, they will default to Direction.RIGHT.
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.
look()- Returns an Array of up to 3 Spaces in the designated Direction.
getSpace()- Returns the next Space on the board.
getHealth()- returns the value of
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.