block by aemkei 1362710

Rubik's Pocket Cube Solver - 140byt.es

Rubik’s Pocket Cube Solver - 140byt.es

Solves Rubik’s Pocket Cube (2x2x2) by using a simple brute force algorithm in only 100 bytes.

Demos:

You have to pass two movement instructions:

        TURN FRONT FACE CW:           ROTATE AROUND Y-AXIS:


              00 01                           01 03
              07 05                           00 02

      04 16   10 08   02 13           23 22   04 05   08 09
      06 17   11 09   03 15           21 20   06 07   10 11

              14 12                           18 16
              18 19                           19 17

              20 21                           15 14
              22 23                           13 12

This will solve the cube in less than a minute (~10.000.000 moves).

The same algorithm may be used to solve the original 3x3x3 cube, but it would take ages to find a solution.

For more information

See the 140byt.es site for a showcase of entries (built itself using 140-byte entries!), and follow @140bytes on Twitter.

To learn about byte-saving hacks for your own code, or to contribute what you’ve learned, head to the wiki.

140byt.es is brought to you by Jed Schmidt, with help from Alex Kloss. It was inspired by work from Thomas Fuchs and Dustin Diaz.

index.js

LICENSE.txt

annotated.js

package.json

test.html