diff options
Diffstat (limited to 'src/core/moves.h')
| -rw-r--r-- | src/core/moves.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/moves.h b/src/core/moves.h index 037944b..3a1158b 100644 --- a/src/core/moves.h +++ b/src/core/moves.h | |||
| @@ -12,6 +12,7 @@ STATIC cube_t move(cube_t, uint8_t); | |||
| 12 | STATIC cube_t premove(cube_t, uint8_t); | 12 | STATIC cube_t premove(cube_t, uint8_t); |
| 13 | STATIC uint8_t inverse_move(uint8_t); | 13 | STATIC uint8_t inverse_move(uint8_t); |
| 14 | STATIC void invertmoves(uint8_t *, uint8_t, uint8_t *); | 14 | STATIC void invertmoves(uint8_t *, uint8_t, uint8_t *); |
| 15 | STATIC void sortparallel(uint8_t *, uint8_t); | ||
| 15 | 16 | ||
| 16 | STATIC int readmoves(const char *, int, uint8_t *); | 17 | STATIC int readmoves(const char *, int, uint8_t *); |
| 17 | STATIC cube_t applymoves(cube_t, const char *); | 18 | STATIC cube_t applymoves(cube_t, const char *); |
| @@ -229,6 +230,17 @@ invertmoves(uint8_t *moves, uint8_t nmoves, uint8_t *ret) | |||
| 229 | } | 230 | } |
| 230 | #pragma GCC pop_options | 231 | #pragma GCC pop_options |
| 231 | 232 | ||
| 233 | STATIC void | ||
| 234 | sortparallel(uint8_t *moves, uint8_t n) | ||
| 235 | { | ||
| 236 | uint8_t i; | ||
| 237 | |||
| 238 | for (i = 0; i < n-1; i++) | ||
| 239 | if (moveaxis(moves[i]) == moveaxis(moves[i+1]) && | ||
| 240 | movebase(moves[i]) == movebase(moves[i+1]) + 1) | ||
| 241 | SWAP(moves[i], moves[i+1]); | ||
| 242 | } | ||
| 243 | |||
| 232 | STATIC int | 244 | STATIC int |
| 233 | readmoves(const char *buf, int max, uint8_t *ret) | 245 | readmoves(const char *buf, int max, uint8_t *ret) |
| 234 | { | 246 | { |
