public class CubeAlgorithm
extends java.lang.Object
Constructor and Description |
---|
CubeAlgorithm() |
Modifier and Type | Method and Description |
---|---|
private boolean |
downEdgeOriented(RubiksCube cube,
ColorsEnum color)
Checks if edge that needs to be moved to second layer is correctly oriented so that it can be moved.
|
private boolean |
edgesInDownLayer(RubiksCube cube)
Checks if there are edges in third layer that need to be moved to second layer.
|
private Corner |
findCorner(RubiksCube cube,
ColorsEnum color1,
ColorsEnum color2,
ColorsEnum color3)
Searches through all corners of given cube-representation and returns the Corner object with the three specified colors.
|
private Edge |
findEdge(RubiksCube cube,
ColorsEnum color1,
ColorsEnum color2)
Searches through all edges of given cube-representation and returns the Edge object with the two specified colors.
|
private void |
firstLevelCorners(RubiksCube cube)
Locates the four corners of first level (top layer of the Rubik's Cube) and moves them correctly oriented onto their positions.
|
private void |
firstLevelEdges(RubiksCube cube)
Locates the four edges of first level (top layer of the Rubik's Cube) and moves them correctly oriented onto their positions.
|
int |
getMenuChoice()
Shows main menu and returns number of selected entry.
|
private int |
llCornerCount(RubiksCube cube)
Counts how many corners of last layer are incorrectly oriented.
|
private boolean |
llCornersPlaced(RubiksCube cube)
Checks if corners of last layer are on their correct positions (they don't need to be oriented correctly yet).
|
private int |
llEdgeCount(RubiksCube cube)
Counts how many edges of last layer are correctly oriented (they don't need to be on the correct position yet).
|
private int |
llEdgeCount2(RubiksCube cube)
Counts how many edges are correctly positioned.
|
static void |
main(java.lang.String[] args)
Main-method, that represent the Roberta-EV3CubeSolvers main program.
|
private void |
moveCorner(RubiksCube cube,
Corner corner)
Applies maneuver to cube-representation, after which given corner is correctly oriented on front-right-up position.
|
private void |
moveEdge(RubiksCube cube,
Edge edge)
Applies maneuver to cube-representation, after which given edge is correctly oriented on front-top-up position.
|
private void |
orientLLCorners(RubiksCube cube)
Orients (rotates) corners of last layer.
|
private void |
orientLLEdges(RubiksCube cube)
Orients edges on last layer.
|
private void |
permuteLLCorners(RubiksCube cube)
Permutes corners on last layer until all corners are correctly positioned.
|
private void |
permuteLLedges(RubiksCube cube)
Permutes edges of last layer until all elements on last layer are correctly colored.
|
private void |
secondLevelEdges(RubiksCube cube)
Moves edges of second layer onto their correct positions.
|
private Edge findEdge(RubiksCube cube, ColorsEnum color1, ColorsEnum color2)
cube
- Internal representation of scanned Rubik's Cube.color1
- First color of searched edge.color2
- Second color of searched edge.private void moveEdge(RubiksCube cube, Edge edge)
cube
- Internal representation of scanned Rubik's Cubeedge
- edge to moveprivate void firstLevelEdges(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cubeprivate Corner findCorner(RubiksCube cube, ColorsEnum color1, ColorsEnum color2, ColorsEnum color3)
cube
- Internal representation of scanned Rubik's Cube.color1
- First color of searched corner.color2
- Second color of searched corner.color3
- Third color of searched corner.private void moveCorner(RubiksCube cube, Corner corner)
cube
- Internal representation of scanned Rubik's Cubecorner
- corner to moveprivate void firstLevelCorners(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private boolean downEdgeOriented(RubiksCube cube, ColorsEnum color)
cube
- Internal representation of scanned Rubik's Cube.color
- Second color of edge (first color is front color).private boolean edgesInDownLayer(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private void secondLevelEdges(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private int llEdgeCount(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private void orientLLEdges(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private boolean llCornersPlaced(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private void permuteLLCorners(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private int llCornerCount(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private void orientLLCorners(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private int llEdgeCount2(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.private void permuteLLedges(RubiksCube cube)
cube
- Internal representation of scanned Rubik's Cube.public int getMenuChoice()
public static void main(java.lang.String[] args)
args
-