-
Notifications
You must be signed in to change notification settings - Fork 0
RubikHelper API RubikSolver
RubikHelper.static.RubikSolverStatic Class that provides all solving methods needed to clear a scrambled cube.
| name | type | notes |
|---|---|---|
explainArray |
Array |
|
solveArray |
Array |
| name | returns | notes |
|---|---|---|
explainCallback(name, value) |
void |
Group of methods for various checks before the solving process begins.
| name | returns | notes |
|---|---|---|
orientedCube(cube) |
Boolean |
Checks if the cube is correctly oriented. |
correctPieces(cube) |
Boolean |
Checks if cube have no duplicated pieces. |
Group of methods used during the solving process.
| name | returns | notes |
|---|---|---|
freeTarget(cube, type, medgeSafe, full) |
`String | Array |
opposite(piece, is_buffer) |
String |
Returns the opposite piece of the given one. |
Group of methods for the solving process.
| name | returns | notes |
|---|---|---|
explain(cube) |
Object |
Returns an object with solve and explain arrays. |
full(cube, type) |
Array |
Returns the complete list of moves to solve the given cube. |
pieces(cube, buffer, MR) |
Array |
Solves a single type of pieces (edges or corners) from a scrambled cube. |
edgesUnoriented(cube) |
Array |
Returns a list of orient patterns to correctly orient all the edges. |
mEdgesUnoriented(flipped) |
Array |
Returns an array of orient patterns to correctly orient all M-Edges. |
RubikHelper.static.RubikSolver.explainArray = []RubikHelper.static.RubikSolver.solveArray = []RubikHelper.static.RubikSolver.explainCallback(name, value)- params
-
{String}name: -
{String}value:
-
- returns
void
RubikHelper.static.RubikSolver.check.orientedCube(cube)Returns TRUE if the cube is correctly oriented (F on Front, U on Up, ...), FALSE otherwise.
- params
-
{Object}cube: the scrambled cube to check
-
- returns
{Boolean}
RubikHelper.static.RubikSolver.check.correctPieces(cube)Returns TRUE if all pieces are single instances.
- params
-
{Object}cube: the scrambled cube to check
-
- returns
{Boolean}
RubikHelper.static.RubikSolver.service.freeTarget(cube, type, medgeSafe, fullList)Returns the first unoriented/unpermuted piece of given cube.
- params
-
{Object}cube: the scrambled cube to search into -
{Number}type: the type of piece to search for -
{Boolean}medgeSafe: if true, pieces on M-slice will be considered solved regardless of their rotation -
{Boolean}fullList: whether should return the first quicker piece left to solve, or the full list of pieces
-
- returns
-
{String}: the unoriented/unpermuted piece -
{Array}: the list of unoriented/unpermuted pieces iffullList = true -
{Boolean}:FALSEif nothing found
-
Notes
type=1 : searches for both edges and corners
type=2 : searches for edges
type=3 : searches for corners
RubikHelper.static.RubikSolver.service.opposite(piece, is_buffer)Returns the opposite piece of the one passed as argument, considering the M2/R2 pattern.
- params
-
{String}piece: the piece to search for -
{Boolean}is_buffer: whether it will opposite pieces on buffer line or not
-
- returns
{String}
Notes
this method will only return the opposite of[UF|FU],[DB|BD],[URF|RFU|FUR],[DRB|BDR|RBD]
whenis_buffer = trueit will return the opposite of[DF|FD],[UB|BU],[DFR|RDF|FRD],[UBR|RUB|BRU]
the returned piece will have the same orientation of given piece
if the piece is not an M-slice's edge or an R-face's corner, it will return the piece itself
RubikHelper.static.RubikSolver.solve.explain(cube)It calls solve.full() and returns an object with solve (s) and explain (e) arrays.
- params
-
{Object}cube: the scrambled cube to be solved
-
- returns
-
{Object}-
{Array}s: solve array -
{Array}e: explain array
-
-
Notes
the explain array should be evaluated by RubikTeacher.explainAll method
RubikHelper.static.RubikSolver.solve.full(cube, type)Returns the complete list of moves to solve the given cube.
- params
-
{Object}cube: the scrambled cube to be solved -
{Number}type: the type of return (default: 0)
-
- returns
-
{Array}: depending on type param, will return the solving sequence with M2R2 method
-
Notes
type=0 : the list of pieces and patterns to execute in the correct order
type=1 : the uncollapsed list of moves
type=2 : the collapsed list of moves
type=3 : the inverted list of moves (ie. the scramble list of moves)
RubikHelper.static.RubikSolver.solve.pieces(cube, buffer, MR)Solves a single type of pieces (edges or corners) from a scrambled cube.
- params
-
{Object}cube: the scrambled cube to be solved -
{String}buffer: the buffer piece -
{Array}MR: list of moves between setup and unsetup (M2orR2)
-
- returns
-
{Array}: ordered list of pieces to be moved
-
RubikHelper.static.RubikSolver.solve.edgesUnoriented(cube)Returns a list of orient patterns to correctly orient all the edges.
- params
-
{Object}cube: the scrambled cube to be solved
-
- returns
{Array}
RubikHelper.static.RubikSolver.solve.mEdgesUnoriented(flipped)Returns an array of orient patterns to correctly orient all M-Edges.
- params
-
{Array}flipped:
-
- returns
{Array}