|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcs1705.tetris.Move
This class represents a single move made by or considered by a Tetris "Brain" class. A move can have a "score" associated with it. This score can be used by a Brain class to reflect the relative value of this move in comparison with alternatives, where higher scores are associated with less valuable moves (think "higher score" means "higher buildup of bricks").
| Constructor Summary | |
Move()
Create a new Move object with zero/null fields. |
|
Move(int x,
int y,
Piece piece,
double score)
Create a new Move object. |
|
| Method Summary | |
boolean |
equals(Object other)
Check whether two moves are the same. |
Piece |
piece()
Retrieve the piece associated with this move. |
double |
score()
Retrieve the score associated with this move. |
void |
setPiece(Piece value)
Change the piece associated with this move. |
void |
setScore(double value)
Change the score associated with this move. |
void |
setX(int value)
Change the x-coordinate of the location for this move's piece. |
void |
setY(int value)
Change the y-coordinate of the location for this move's piece. |
String |
toString()
Returns a human-readable string representation of this Move. |
int |
x()
Retrieve the x-coordinate of the location for this move's piece. |
int |
y()
Retrieve the y-coordinate of the location for this move's piece. |
| Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Move()
public Move(int x,
int y,
Piece piece,
double score)
x - the x-coordinate to usey - the y-coordinate to usepiece - the piece to usescore - the score to use| Method Detail |
public boolean equals(Object other)
other - the move to compare against
public Piece piece()
public double score()
public void setPiece(Piece value)
value - the new piece to usepublic void setScore(double value)
value - the new score to usepublic void setX(int value)
value - the new x-coordinate to usepublic void setY(int value)
value - the new y-coordinate to usepublic String toString()
public int x()
public int y()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||