|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectMaze
public class Maze
The Maze Java application illustrates the use of
the traverseMaze method that uses recursion to guide a user
into a maze and back out again.
| Constructor Summary | |
|---|---|
Maze()
|
|
| Method Summary | |
|---|---|
static boolean |
deadend()
Determines whether the person traversing the maze has reached a dead end. |
static boolean |
inquire(java.lang.String query)
Asks a yes/no question and reads the answer. |
static void |
main(java.lang.String[] args)
The main method activates traverseMaze and prints a message
indicating whether the tapestry was found. |
static boolean |
traverseMaze()
Provides interactive help to guide a user through a maze and back out. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Maze()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
traverseMaze and prints a message
indicating whether the tapestry was found. The String
argument (args) is not used in this implementation.
public static boolean deadend()
- - none
true if the direction directly in front
of the user
is a dead end (that is, a direction that cannot contain the tapestry).public static boolean inquire(java.lang.String query)
query - a question to ask
query has been printed to System.out, and
a one-character response read from System.in (skipping any
whitespace characters. The method returns true if the
user’s response was ‘Y’ or ‘y’, and returns false if the
user’s response was ‘N’ or ‘n’.
(If the response is some other character, then the query is repeated and
a new answer is read.)public static boolean traverseMaze()
- - none
true; otherwise the method returns
false.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||