|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectexample.pushpuzzle.Board
public class Board
The class Board knows how the pieces move, handles undo, and handles reading of screens.
Field Summary | |
---|---|
static int |
DOWN
|
static byte |
GROUND
|
static int |
LEFT
|
static int |
MOVEPACKET
|
static byte |
PACKET
|
static byte |
PUSHER
|
static int |
RIGHT
|
static byte |
STORE
|
static int |
UP
|
static byte |
WALL
|
Constructor Summary | |
---|---|
Board()
Creates new Board initialized to a simple puzzle. |
Method Summary | |
---|---|
byte |
get(int x,
int y)
Return the pieces at the location. |
int |
getHeight()
Get the height of the board. |
int |
getMoves()
Get the number of moves to get this far. |
int |
getPusherLocation()
Get the location of the pusher. |
int |
getPushes()
Get the number of packets pushed around. |
int |
getStored()
Get the number of packets stored. |
int |
getWidth()
Get the width of the game board. |
int |
move(int move)
Move the pusher in the direction indicated. |
void |
read(java.io.InputStream is,
int l)
Read a board from a stream. |
int |
runTo(int x,
int y,
int max)
Move the player to the position (x,y), if possible. |
void |
screen0()
Create the hard coded simple game board. |
boolean |
solved()
Determine if the screen has been solved. |
int |
undoMove()
Undo the most recent move |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LEFT
public static final int RIGHT
public static final int UP
public static final int DOWN
public static final int MOVEPACKET
public static final byte GROUND
public static final byte STORE
public static final byte PACKET
public static final byte WALL
public static final byte PUSHER
Constructor Detail |
---|
public Board()
Method Detail |
---|
public void screen0()
public int move(int move)
move
- the direction; one of LEFT, RIGHT, UP, DOWN
public int undoMove()
public boolean solved()
public int runTo(int x, int y, int max)
x
- window coordinatey
- window coordinate
public byte get(int x, int y)
x
- location in the board.y
- location in the board.
public int getPusherLocation()
public void read(java.io.InputStream is, int l)
public int getWidth()
public int getHeight()
public int getMoves()
public int getPushes()
public int getStored()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |