Skip to content

Commit 79737b1

Browse files
committed
readme
1 parent 79e793f commit 79737b1

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README

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

0 commit comments

Comments
 (0)