Skip to content

Commit

Permalink
Initial check-in of llminxsolver v1.0 (2008).
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzthief81 committed Dec 25, 2019
1 parent 4e5cf40 commit 1d27925
Show file tree
Hide file tree
Showing 29 changed files with 4,631 additions and 0 deletions.
1,095 changes: 1,095 additions & 0 deletions src/llminx/LLMinx.java

Large diffs are not rendered by default.

146 changes: 146 additions & 0 deletions src/llminx/LLMinxProfiler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
package llminx;

/**
*
*/

public class LLMinxProfiler {

private static int MOVE_COUNT = 10000000;

public static void main(String[] args) {
LLMinx.setMaxDepth(MOVE_COUNT);
LLMinx.setKeepMoves(false );
LLMinx minx = new LLMinx();
long time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveF();
}
System.out.println("Performed " + MOVE_COUNT + " F moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveFi();
}
System.out.println("Performed " + MOVE_COUNT + " Fi moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveF2();
}
System.out.println("Performed " + MOVE_COUNT + " F2 moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveF2i();
}
System.out.println("Performed " + MOVE_COUNT + " F2i moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveR();
}
System.out.println("Performed " + MOVE_COUNT + " R moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveRi();
}
System.out.println("Performed " + MOVE_COUNT + " Ri moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveR2();
}
System.out.println("Performed " + MOVE_COUNT + " R2 moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveR2i();
}
System.out.println("Performed " + MOVE_COUNT + " R2i moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveU();
}
System.out.println("Performed " + MOVE_COUNT + " U moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveUi();
}
System.out.println("Performed " + MOVE_COUNT + " Ui moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveU2();
}
System.out.println("Performed " + MOVE_COUNT + " U2 moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveU2i();
}
System.out.println("Performed " + MOVE_COUNT + " U2i moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveL();
}
System.out.println("Performed " + MOVE_COUNT + " L moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveLi();
}
System.out.println("Performed " + MOVE_COUNT + " Li moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveL2();
}
System.out.println("Performed " + MOVE_COUNT + " L2 moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveL2i();
}
System.out.println("Performed " + MOVE_COUNT + " L2i moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveB();
}
System.out.println("Performed " + MOVE_COUNT + " B moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveBi();
}
System.out.println("Performed " + MOVE_COUNT + " Bi moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveB2();
}
System.out.println("Performed " + MOVE_COUNT + " B2 moves in " + (System.currentTimeMillis() - time) + "ms");
minx = new LLMinx();
time = System.currentTimeMillis();
for (int i = 0; i < MOVE_COUNT; i++) {
minx.moveB2i();
}
System.out.println("Performed " + MOVE_COUNT + " B2i moves in " + (System.currentTimeMillis() - time) + "ms");

for (byte i = 0; i < LLMinx.MOVE_STRINGS.length; i++) {
minx = new LLMinx();
time = System.currentTimeMillis();
for (int move = 0; move < MOVE_COUNT; move++) {
minx.move(i);
}
System.out.println("Performed " + MOVE_COUNT + " " + LLMinx.MOVE_STRINGS[i] + " moves using switch in " + (System.currentTimeMillis() - time) + "ms");
}

}

}
194 changes: 194 additions & 0 deletions src/llminx/LLMinxTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
package llminx;

/**
*
*/

public class LLMinxTest {

public static void main(String[] args) {
int move_count = 5;
LLMinx solved = new LLMinx();
LLMinx minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveF();
}
System.out.println("Move F implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveFi();
}
System.out.println("Move Fi implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveF2();
}
System.out.println("Move F2 implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveF2i();
}
System.out.println("Move F2i implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveR();
}
System.out.println("Move R implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveRi();
}
System.out.println("Move Ri implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveR2();
}
System.out.println("Move R2 implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveR2i();
}
System.out.println("Move R2i implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveU();
}
System.out.println("Move U implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveUi();
}
System.out.println("Move Ui implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveU2();
}
System.out.println("Move U2 implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveU2i();
}
System.out.println("Move U2i implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveL();
}
System.out.println("Move L implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveLi();
}
System.out.println("Move Li implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveL2();
}
System.out.println("Move L2 implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveL2i();
}
System.out.println("Move L2i implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveB();
}
System.out.println("Move B implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveBi();
}
System.out.println("Move Bi implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveB2();
}
System.out.println("Move B2 implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
for (int i = 0; i < move_count; i++) {
minx.moveB2i();
}
System.out.println("Move B2i implemented " + (solved.equals(minx) ? "correctly." : "wrongly."));
minx = new LLMinx();
minx.moveF();
minx.moveFi();
System.out.println("Move F and Fi " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveFi();
minx.moveF();
System.out.println("Move Fi and F " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveF2();
minx.moveF2i();
System.out.println("Move F2 and F2i " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveF2i();
minx.moveF2();
System.out.println("Move F2i and F2 " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveR();
minx.moveRi();
System.out.println("Move R and Ri " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveRi();
minx.moveR();
System.out.println("Move Ri and R " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveR2();
minx.moveR2i();
System.out.println("Move R2 and R2i " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveR2i();
minx.moveR2();
System.out.println("Move R2i and R2 " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveL();
minx.moveLi();
System.out.println("Move L and Li " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveLi();
minx.moveL();
System.out.println("Move Li and L " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveL2();
minx.moveL2i();
System.out.println("Move L2 and L2i " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveL2i();
minx.moveL2();
System.out.println("Move L2i and L2 " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveU();
minx.moveUi();
System.out.println("Move U and Ui " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveUi();
minx.moveU();
System.out.println("Move Ui and U " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveU2();
minx.moveU2i();
System.out.println("Move U2 and U2i " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveU2i();
minx.moveU2();
System.out.println("Move U2i and U2 " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveB();
minx.moveBi();
System.out.println("Move B and Bi " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveBi();
minx.moveB();
System.out.println("Move Bi and B " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveB2();
minx.moveB2i();
System.out.println("Move B2 and B2i " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
minx = new LLMinx();
minx.moveB2i();
minx.moveB2();
System.out.println("Move B2i and B2 " + (solved.equals(minx) ? "cancel out." : "don't cancel out."));
}

}
32 changes: 32 additions & 0 deletions src/llminx/gui/LLMinxCenterSticker.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package llminx.gui;

import llminx.LLMinx;

import java.awt.*;

/**
*
*/
public class LLMinxCenterSticker extends LLMinxSticker {

public LLMinxCenterSticker(LLMinxCubie cubie, byte orientation) {
super(cubie, orientation);
}

public void paint(Graphics aGraphics, boolean aSelected, LLMinx aMinx) {
applyFillStyle(aGraphics,0);
aGraphics.fillPolygon(this);
applyLineStyle(aGraphics, false);
aGraphics.drawPolygon(this);
}

public boolean interactsWith(LLMinxSticker aCubie, LLMinx aMinx) {
return false;
}

public void paintInteraction(Graphics aGraphics, LLMinxSticker aCubie, LLMinx aMinx) {
}

public void performInteraction(LLMinxSticker aCubie, LLMinx aMinx) {
}
}

0 comments on commit 1d27925

Please sign in to comment.