Description Usage Arguments Value Examples
Function returns TRUE if cube is solved (each side contains exactly one colour) and FALSE otherwise.
1 | is.solved(cube)
|
cube |
- cube object to be tested |
TRUE/FALSE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Create new cube:
cube <- createCube(3)
## And it is solved:
is.solved(cube) # TRUE
## Now, test how many times repeating LFRB moves will bring back initial state:
cube <- twistCube(cube,'LFRB')
i <- 1
while(!is.solved(cube))
{
cube <- twistCube(cube,'LFRB')
i <- i + 1
}
print(i) # 315
## Check one more time if this is a solution:
is.solved(twistCube(cube,'LFRB',315)) # TRUE
## Check if really 314 moves and 316 moves don't give solution:
is.solved(twistCube(cube,'LFRB',314)) || is.solved(twistCube(cube,'LFRB',316)) # FALSE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.