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

Method image

app/src/main/java/solver/EightPuzzle.java:102–124  ·  view source on GitHub ↗
(String scramble)

Source from the content-addressed store, hash-verified

100 }
101
102 public static int[] image(String scramble) {
103 for (int i = 0; i < 9; i++) pz[i] = i;
104 int blank = 8;
105 String[] s = scramble.split(" ");
106 for (int i = 0; i < s.length; i++) {
107 if (s[i].length() > 0) {
108 int move = "DURL".indexOf(s[i].charAt(0));
109 int next = moveIdx[blank][move];
110 if (next != -1) {
111 Utils.swap(pz, blank, next);
112 blank = next;
113 }
114 if (s[i].length() > 1 && s[i].charAt(1) == '2') {
115 next = moveIdx[blank][move];
116 if (next != -1) {
117 Utils.swap(pz, blank, next);
118 blank = next;
119 }
120 }
121 }
122 }
123 return pz;
124 }
125}

Callers 1

drawScrambleMethod · 0.95

Calls 3

swapMethod · 0.95
lengthMethod · 0.80
indexOfMethod · 0.80

Tested by

no test coverage detected