org.almacha.achamaze
Class FollowLeftWallAlgo

java.lang.Object
  extended by org.almacha.achamaze.MazeSolvingAlgorithm
      extended by org.almacha.achamaze.FollowLeftWallAlgo

public class FollowLeftWallAlgo
extends MazeSolvingAlgorithm

An implementation of the "follow left wall" maze solving algorithm. This algorithm may not enable you to escape from the maze. This algorithm works by first going in a random direction until we find a wall. Then we follow that wall forever and hope (but that may not happen) we escape form the maze.

Author:
almacha

Field Summary
private  boolean followingWall
           
private  Direction going
           
 
Constructor Summary
FollowLeftWallAlgo(PlayerStateForMazeAlgo playerState)
           
 
Method Summary
protected  Direction decide()
          This method decides in which direction the player should go.
 
Methods inherited from class org.almacha.achamaze.MazeSolvingAlgorithm
getPlayerState, move
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

followingWall

private boolean followingWall

going

private Direction going
Constructor Detail

FollowLeftWallAlgo

public FollowLeftWallAlgo(PlayerStateForMazeAlgo playerState)
Method Detail

decide

protected Direction decide()
Description copied from class: MazeSolvingAlgorithm
This method decides in which direction the player should go. When this method is called, the player will then move in the chosen direction. So your implementation of decide() can assume that the player is moved in the direction you return. This method should never be called directly, even from derived classes, use move() instead.

Specified by:
decide in class MazeSolvingAlgorithm
Returns:
the chosen direction