Amazing Mazes

Class Smarty

java.lang.Object
  |
  +--Mouse
        |
        +--Smarty
Direct Known Subclasses:
FocusedL, FocusedR, Goaly, NESW, Randy, SWEN

public abstract class Smarty
extends Mouse

The Smarty mouse is a base class with a brain. It improves the advance() and retreat() method by leaving a trail of bread in the form of an invisible wall.

Version:
1.0 11/11/2000
Author:
Andrew Bridges ... Copyright (c) 2001

Fields inherited from class Mouse
curPosition_, mazeAdapter_, stack_
 
Constructor Summary
Smarty()
           
 
Method Summary
protected  void advance(Direction direction)
          This advance() method does everything the base class advance() does, but adds a memory by closing the wall behind it (sort of like leaving a trail of bread).
protected  void retreat()
          This retreat() method does everything the base class retreat() does, but adds a memory by closing the wall behind it (sort of like leaving a trail of bread).
 
Methods inherited from class Mouse
distanceToGoal, makeAMove, passagewayOpenAt, randomInt, solveMaze
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Smarty

public Smarty()
Method Detail

advance

protected void advance(Direction direction)
                throws InvalidMove
This advance() method does everything the base class advance() does, but adds a memory by closing the wall behind it (sort of like leaving a trail of bread).
Overrides:
advance in class Mouse
Parameters:
direction - the direction to advance.
Throws:
InvalidMove - the specified direction constitutes an invalid move. Either a wall exists in this direction, or it is a cell we just came from in our currenent traversal path (this requires usage of the retreat() method).

retreat

protected void retreat()
                throws NoSolutionFound
This retreat() method does everything the base class retreat() does, but adds a memory by closing the wall behind it (sort of like leaving a trail of bread).
Overrides:
retreat in class Mouse
Throws:
NoSolutionFound - either there is no solution to this maze, or we have a programming bug :-(

Author: Andrew Bridges
Copyright © 2001