OCaml Forge

Browse | Submit A New Snippet | Create A Package

Rubik Pocket cube

Sample Code (HOWTO)
GNU Library Public License
Other Language
How to solve the 2 x 2 Rubik Pocket cube using the OCaml-Idaho library.

Versions Of This Snippet:

Snippet ID Download Version Date Posted Author Delete
81.02009-08-10 22:34Damien Guichard

Download a raw-text version of this code by clicking on "Download Version"


Latest Snippet Version: 1.0

(* initialisation *) module Cube = PocketCube;; module CubeMap = UnbalancedMap.Mutable(Cube);; module CubeSolver = Search.Make(Cube)(CubeMap);; Random.self_init ();; (* scramble the cube using 60 random moves *) let scrambled,moves = Cube.scramble Cube.initial 60;; (* solve the scramble *) let sol = CubeSolver.bidirectionnal Cube.player Cube.zip scrambled [] Cube.initial [];; (* print one solution *) CubeMap.choose sol;;

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..