|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsmithers.twisty.Snake
public class Snake
Represents a Rubik's Snake.
| Constructor Summary | |
|---|---|
Snake()
Creates a Rubik's Snake with 24 pieces. |
|
Snake(int pieces)
Creates a Rubik's Snake-like puzzle with the specified number of pieces. |
|
| Method Summary | |
|---|---|
int |
getColor(int index)
Gets the colour of the specified sticker. |
Polygon3D |
getPolygon(int index)
Gets the 3-d polygon associated with the specified sticker. |
double |
getScale()
Returns the absolute scale of the 3-d model of the puzzle. |
Twist |
getTwist(int index,
int dir)
Gets the twist instance determined by the sticker clicked on, and the directon to twist. |
boolean |
isSolved()
Works out whether this puzzle is in the solved state. |
void |
scramble()
Scrambles the puzzle. |
int |
stickerCount()
Gets the number of stickers on the puzzle. |
void |
twist(Twist twist)
Applies a twist. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Snake()
public Snake(int pieces)
pieces - the number of pieces| Method Detail |
|---|
public int stickerCount()
stickerCount in interface TwistyPuzzlepublic int getColor(int index)
getColor in interface TwistyPuzzleindex - the sticker index
public double getScale()
getScale in interface TwistyPuzzlepublic Polygon3D getPolygon(int index)
getPolygon in interface TwistyPuzzleindex - the sticker index
public Twist getTwist(int index,
int dir)
TwistyPuzzle.twist(smithers.twisty.Twist) (i.e. will not throw
ClassCastException, although the move may not be possible). The
dir argument should be: 0 for anticlockwise, 1 for clockwise or
2 for a half twist.
getTwist in interface TwistyPuzzleindex - the sticker which was clicked ondir - the directon
public void twist(Twist twist)
twist in interface TwistyPuzzletwist - the twistpublic void scramble()
scramble in interface TwistyPuzzlepublic boolean isSolved()
isSolved in interface TwistyPuzzletrue iff the puzzle is solved
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||