From abadc0e24d7fd1ade52e3ced31892cf5037b9cf6 Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Tue, 26 Apr 2022 01:40:02 +0200 Subject: Small changes --- src/cube.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/cube.h') diff --git a/src/cube.h b/src/cube.h index ccc83d2..e25dce4 100644 --- a/src/cube.h +++ b/src/cube.h @@ -149,6 +149,13 @@ typedef enum { NULL_ROT } rotations; +static char *rot_strings[] = { + "R", "L", "U", "D", "F", "B", + "R'", "L'", "U'", "D'", "F'", "B'", + "R2", "L2", "U2", "D2", "F2", "B2", + "", +}; + typedef void (*rot_f)(cube_t *); static const rot_f rot_func[] = { @@ -158,7 +165,8 @@ static const rot_f rot_func[] = { rotation_d, rotation_f, rotation_b, - rotation_rp, rotation_lp, + rotation_rp, + rotation_lp, rotation_up, rotation_dp, rotation_fp, @@ -247,7 +255,7 @@ static rotations* parse_scramble(char **str) { } static char **tokenize_rot_str(char *str) { - const char *delims = " \n\t"; + const char *delims = " \n\t,"; ssize_t capacity = 20; char **tokens = (char **)calloc(sizeof(char *), capacity); int tok_cnt = 0; @@ -298,6 +306,10 @@ static void init_cube(cube_t *cube) { } } +static char *rot_to_str(rotations rot) { + return rot_strings[(int)rot]; +} + /******************************************************************************/ /* Printint cube state ********************************************************/ -- cgit v1.2.3