MCPcopy Create free account
hub / github.com/MeigenChou/DCTimer-Android / applyMove

Method applyMove

app/src/main/java/solver/Sq1Shape.java:54–73  ·  view source on GitHub ↗
(int state, String move)

Source from the content-addressed store, hash-verified

52 }
53
54 public static int applyMove(int state, String move) {
55 //State state = this;
56 if (move.length() == 0) return state;
57 if (move.equals("/")) {
58 state = twist(state);
59 } else {
60 Pattern p = Pattern.compile("\\((-?\\d+),(-?\\d+)\\)");
61 Matcher matcher = p.matcher(move);
62 matcher.find();
63 int top = Integer.parseInt(matcher.group(1));
64 for (int i = 0; i < top + 12; i++) {
65 state = rotateTop(state);
66 }
67 int bottom = Integer.parseInt(matcher.group(2));
68 for (int i = 0; i < bottom + 12; i++) {
69 state = rotateBottom(state);
70 }
71 }
72 return state;
73 }
74
75 public static int applySequence(String[] sequence) {
76 int state = solved;

Callers 1

applySequenceMethod · 0.95

Calls 5

twistMethod · 0.95
rotateTopMethod · 0.95
rotateBottomMethod · 0.95
lengthMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected