java.lang.Objectgreenfoot.Actor
Cube
public class Cube
Repraesentation eines virtuellen Rubiks-Cube. Direkt nach dem Konstruktor-Aufruf ist der Wuerfel vollstaendig geloest. Ueber statische Attribute der Klasse ist eine Orientierung "OBEN, UNTEN,..." und eine Farbnennung "ROT, BLAU, ..." festgelegt.
Die Sichtperspektive auf den Wuerfel ist dabei immer von VORNE. Bei der getColor-Methode ist eine Angabe in Zeilen und Spalten unklar, wenn die Art der Perspektive nicht klar definiert ist. Um eine Sicht auf die jeweiligen Flächen zu definieren ist daher die Wurfeldrehung festgelegt, durch die die gesuchte Flaeche nach vorne gelangt. Die Notation der Drehung ist dabei bezogen auf http://de.wikipedia.org/wiki/Zauberwürfel#Buchstabennotation
x (rotate): rotate the entire Cube on R
y (rotate): rotate the entire Cube on U
z (rotate): rotate the entire Cube on F
HINTEN: y2
RECHTS: y
LINKS: y'
OBEN: x'
UNTEN: x
Zusaetzliche Bewegungsmoeglichkeiten sind nach http://en.wikipedia.org/wiki/Rubik%27s_Cube#Move_notation eingebaut (standing, equator, middle).
Field Summary | |
---|---|
static int |
BLAU
|
static int |
GELB
|
static int |
GRUEN
|
static int |
HINTEN
|
static int |
LINKS
|
static int |
OBEN
|
static int |
ORANGE
|
static int |
RECHTS
|
static int |
ROT
|
static int |
UNTEN
|
static int |
VORNE
|
static int |
WEISS
|
Constructor Summary | |
---|---|
Cube()
Ein vollstaendig geloester Wuerfel wird erstellt. |
Method Summary | |
---|---|
void |
back()
|
void |
back2()
|
void |
backInverse()
|
java.lang.String |
color2String(int color)
|
void |
connectToWorld(BG pworld)
Herstellung einer Verbindung zu einem BG-Objekt. |
void |
down()
|
void |
down2()
|
void |
downInverse()
|
void |
equator()
|
void |
equator2()
|
void |
equatorInverse()
|
void |
front()
|
void |
front2()
|
void |
frontInverse()
|
int |
getColor(CubePosition cp)
Diese Methode gibt die aktuelle Farbe einer Wuerfelteilflaeche zurueck. |
int |
getColor(int flaechencode,
int x,
int y)
Diese Methode gibt die aktuelle Farbe einer Wuerfelteilflaeche zurueck. |
void |
left()
|
void |
left2()
|
void |
leftInverse()
|
void |
loeseWuerfel()
|
void |
middle()
|
void |
middle2()
|
void |
middleInverse()
|
void |
right()
|
void |
right2()
|
void |
rightInverse()
|
void |
scramble()
|
CubePosition |
searchForCorner(int color1,
int color2)
Diese Methode sucht nach einer Ecke, die durch die angegebenen Farben definiert ist. |
CubePosition |
searchForEdge(int color1,
int color2)
Diese Methode sucht nach einer Kante, die durch die angegebenen Farben definiert ist. |
void |
smallBack()
|
void |
smallBack2()
|
void |
smallBackInverse()
|
void |
smallDown()
|
void |
smallDown2()
|
void |
smallDownInverse()
|
void |
smallFront()
|
void |
smallFront2()
|
void |
smallFrontInverse()
|
void |
smallLeft()
|
void |
smallLeft2()
|
void |
smallLeftInverse()
|
void |
smallRight()
|
void |
smallRight2()
|
void |
smallRightInverse()
|
void |
smallUp()
|
void |
smallUp2()
|
void |
smallUpInverse()
|
void |
standing()
|
void |
standing2()
|
void |
standingInverse()
|
void |
up()
|
void |
up2()
|
void |
updateView()
Ein Aufruf dieser Methode gibt an ein eventuell verbundenes BG-Objekt den Hinweis auf eine evtl. |
void |
upInverse()
|
void |
xCubeRotate()
|
void |
yCubeRotate()
|
void |
zCubeRotate()
|
Methods inherited from class |
---|
act, addedToWorld, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWorld, getX, getY, intersects, isTouching, move, removeTouching, setImage, setImage, setLocation, setRotation, turn, turnTowards |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int BLAU
public static final int GELB
public static final int GRUEN
public static final int HINTEN
public static final int LINKS
public static final int OBEN
public static final int ORANGE
public static final int RECHTS
public static final int ROT
public static final int UNTEN
public static final int VORNE
public static final int WEISS
Constructor Detail |
---|
public Cube()
Method Detail |
---|
public void back()
public void back2()
public void backInverse()
public java.lang.String color2String(int color)
public void connectToWorld(BG pworld)
public void down()
public void down2()
public void downInverse()
public void equator()
public void equator2()
public void equatorInverse()
public void front()
public void front2()
public void frontInverse()
public int getColor(CubePosition cp)
cp
- Ein CubePosition-Objekt, in dem Flaechencode, Zeile und Spalte bereits enthalten ist.public int getColor(int flaechencode, int x, int y)
flaechencode
- Auf welcher Seite des Wuerfels geschaut werden soll (OBEN, UNTEN, ...)x
- Zeile, nummeriert von 0 bis 2 und von oben nach unten
(auf einer Fläche die Ecke rechts oben haette x=2 und y=0)
(auf einer Fläche die Ecke links unten haette x=0 und y=2)y
- Spalte, nummeriert von 0 bis 2 und von links nach rechts
(auf einer Fläche die Ecke rechts oben haette x=2 und y=0)
(auf einer Fläche die Ecke links unten haette x=0 und y=2)public void left()
public void left2()
public void leftInverse()
public void loeseWuerfel()
public void middle()
public void middle2()
public void middleInverse()
public void right()
public void right2()
public void rightInverse()
public void scramble()
public CubePosition searchForCorner(int color1, int color2)
color1
- Die erste Farbe, deren Position zurueckgegeben wird.color2
- Die zweite Farbe, die zur Unterscheidung der vier unterschiedlichen Kanten zusaetzlich angegeben werden muss.
public CubePosition searchForEdge(int color1, int color2)
color1
- Die erste Farbe, deren Position zurueckgegeben wird.color2
- Die zweite Farbe, die zur Unterscheidung der vier unterschiedlichen Kanten zusaetzlich angegeben werden muss.
public void smallBack()
public void smallBack2()
public void smallBackInverse()
public void smallDown()
public void smallDown2()
public void smallDownInverse()
public void smallFront()
public void smallFront2()
public void smallFrontInverse()
public void smallLeft()
public void smallLeft2()
public void smallLeftInverse()
public void smallRight()
public void smallRight2()
public void smallRightInverse()
public void smallUp()
public void smallUp2()
public void smallUpInverse()
public void standing()
public void standing2()
public void standingInverse()
public void up()
public void up2()
public void updateView()
public void upInverse()
public void xCubeRotate()
public void yCubeRotate()
public void zCubeRotate()