Class FeelingRobot

java.lang.Object
   |
   +----Robot
           |
           +----BouncingRobot
                   |
                   +----FeelingRobot

public class FeelingRobot
extends BouncingRobot
FeelingRobot is a BouncingRobot except that it uses sensors to detect the wall before actually hitting it. (Hopefully, this will protect the stepper from stress.)


Variable Index

 o back
 o front

Constructor Index

 o FeelingRobot(Stepper, Color, Sensor, Sensor)
FeelingRobot now also accepts Sensor objects for the whiskers and tail, which are the front and back sensors, respectively.

Method Index

 o act()
This overrides BouncingRobots act().

Variables

 o front
 protected Sensor front
 o back
 protected Sensor back

Constructors

 o FeelingRobot
 public FeelingRobot(Stepper s,
                     Color c,
                     Sensor whiskers,
                     Sensor tail)
FeelingRobot now also accepts Sensor objects for the whiskers and tail, which are the front and back sensors, respectively.

Methods

 o act
 public void act()
This overrides BouncingRobots act(). Here, right before we try to move, we check the sensors and adjust the direction accordingly if the sensors sense anything.

Overrides:
act in class BouncingRobot