inRoom() is really hard and needs more scaffolding. Perhaps one way to do this could be:
- Introduce a
positionLoop() method that returns an array with the states of each of the four cells we reach walking in a specified direction.
- Outline an implementation of
inRoom() where you call positionLoop() for every possible direction. You then count how many are clear. If all four are clear you are in a room.
inRoom()is really hard and needs more scaffolding. Perhaps one way to do this could be:positionLoop()method that returns an array with the states of each of the four cells we reach walking in a specified direction.inRoom()where you callpositionLoop()for every possible direction. You then count how many are clear. If all four are clear you are in a room.