Skip to content

Commit 0264ea4

Browse files
committed
readme
1 parent 79737b1 commit 0264ea4

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

README

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
node-two-phase-algorithm
3+
============
4+
5+
An algorithm to solve Rubik's cube.
6+
------------
7+
8+
The Two-Phase-Algorithm was created by Herbert Kociemba, read more: http://kociemba.org/cube.htm
9+
This is a Node.js module ported from his Java package.
10+
11+
This module uses child_process.fork() to keep the main process from freezing.
12+
13+
### Example code/usage:
14+
15+
#!/usr/bin/env node
16+
var twophase = require('twophase');
17+
18+
console.log("Initiating algorithm...");
19+
twophase.initialize(function () {
20+
console.log("Ready");
21+
22+
// This just tests the solve, solution is F
23+
twophase.solve("UUUUUURRRDRRDRRDRRFFFFFFFFFLLLDDDDDDLLULLULLUBBBBBBBBB", 30, 60, false, function (err, solution) {
24+
if (err) console.error(err);
25+
26+
twophase.randomCube(function (err, randomCube) {
27+
if (err) console.error(err);
28+
var cube = randomCube;
29+
//cube = "DUDLUDLFDRBRFRBLUUBUBLFRLDFFFUDDBRDRBFUBLUULDFRLRBLBRF";
30+
console.log(cube);
31+
32+
twophase.solve(cube, 30, 60, false, function (err, solution) {
33+
if (err) console.error(err);
34+
console.log("Solution:", solution);
35+
twophase.close();
36+
});
37+
});
38+
39+
});
40+
});
41+
42+
Other (unused in the example) methods:
43+
`twophase.verify(cube, callback);`
44+
callback contains the parameters (err, code)

0 commit comments

Comments
 (0)