(int state)
| 253 | } |
| 254 | |
| 255 | private static String solveTrn(int state) { |
| 256 | initf(); |
| 257 | // int state = applySequence(scr.split(" ")); |
| 258 | StringBuilder sequence = new StringBuilder("\n\nftm: "); |
| 259 | while (prunTrn[getShape2Idx(state)] > 0) { |
| 260 | // twist |
| 261 | if (canTwist(state)) { |
| 262 | int next = twist(state); |
| 263 | if (prunTrn[getShape2Idx(next)] == prunTrn[getShape2Idx(state)] - 1) { |
| 264 | sequence.append("/ "); |
| 265 | state = next; |
| 266 | } |
| 267 | } |
| 268 | // rotate top |
| 269 | int x = 0; |
| 270 | int nextTop = state; |
| 271 | for (int i = 0; i < 12; i++) { |
| 272 | int temp=getShape2Idx(nextTop); |
| 273 | if (temp >= 0 && prunTrn[temp] == prunTrn[getShape2Idx(state)] - 1) { |
| 274 | x = i; |
| 275 | state = nextTop; |
| 276 | break; |
| 277 | } |
| 278 | nextTop = rotateTop(nextTop); |
| 279 | } |
| 280 | // rotate bottom |
| 281 | int y = 0; |
| 282 | int nextBottom = state; |
| 283 | for (int j = 0; j < 12; j++) { |
| 284 | int temp=getShape2Idx(nextBottom); |
| 285 | if (temp >= 0 && prunTrn[temp] == prunTrn[getShape2Idx(state)] - 1) { |
| 286 | y = j; |
| 287 | state = nextBottom; |
| 288 | break; |
| 289 | } |
| 290 | nextBottom = rotateBottom(nextBottom); |
| 291 | } |
| 292 | if (x != 0 || y != 0) { |
| 293 | sequence.append('(').append(x <= 6 ? x : x - 12).append(',').append(y <= 6 ? y : y - 12).append(") "); |
| 294 | } |
| 295 | } |
| 296 | return sequence.toString(); |
| 297 | } |
| 298 | |
| 299 | private static String solveTws(int state) { |
| 300 | initt(); |
no test coverage detected