aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/moves.h12
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);
12STATIC cube_t premove(cube_t, uint8_t); 12STATIC cube_t premove(cube_t, uint8_t);
13STATIC uint8_t inverse_move(uint8_t); 13STATIC uint8_t inverse_move(uint8_t);
14STATIC void invertmoves(uint8_t *, uint8_t, uint8_t *); 14STATIC void invertmoves(uint8_t *, uint8_t, uint8_t *);
15STATIC void sortparallel(uint8_t *, uint8_t);
15 16
16STATIC int readmoves(const char *, int, uint8_t *); 17STATIC int readmoves(const char *, int, uint8_t *);
17STATIC cube_t applymoves(cube_t, const char *); 18STATIC 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
233STATIC void
234sortparallel(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
232STATIC int 244STATIC int
233readmoves(const char *buf, int max, uint8_t *ret) 245readmoves(const char *buf, int max, uint8_t *ret)
234{ 246{

Generated with cgit - Back to sebastiano.tronto.net