|
Algorithm Development Kit 1.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectalgs.model.problems.eightpuzzle.SlideMove
public class SlideMove
Slide a numbered tile from (r,c) to (r', c').
| Field Summary | |
|---|---|
int |
fromC
column coordinate of the move's source. |
int |
fromR
row coordinate of the move's source. |
int |
tile
tile being moved. |
int |
toC
column coordinate of the move's destination. |
int |
toR
row coordinate of the move's destination. |
| Constructor Summary | |
|---|---|
SlideMove(int tile,
int fromR,
int fromC,
int toR,
int toC)
Move from (fromC, fromR) -> (toC, toR) |
|
| Method Summary | |
|---|---|
boolean |
execute(INode n)
Execute the move on the given board state. |
boolean |
isValid(INode n)
Determine if move is valid for the given state. |
java.lang.String |
toString()
Reasonable implementation. |
boolean |
undo(INode n)
Assume move had been valid, so the undo is a straightforward swap. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final int tile
public final int fromR
public final int fromC
public final int toR
public final int toC
| Constructor Detail |
|---|
public SlideMove(int tile,
int fromR,
int fromC,
int toR,
int toC)
tile - tile to move.fromR - row coordinate of the move's source.fromC - column coordinate of the move's source.toR - row coordinate of the move's destinationtoC - column coordinate of the move's destination| Method Detail |
|---|
public boolean execute(INode n)
execute in interface IMoven - state on which to execute the move.public boolean isValid(INode n)
isValid in interface IMoven -
java.lang.IllegalArgumentException - if n is not an EightPuzzleNodepublic boolean undo(INode n)
undo in interface IMoven - game state whose move is to be undone.public java.lang.String toString()
toString in class java.lang.Object
|
Algorithm Development Kit 1.0 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||