(int state, String move)
| 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; |
no test coverage detected