diff options
author | Franciszek Malinka <franciszek.malinka@gmail.com> | 2022-04-26 01:40:02 +0200 |
---|---|---|
committer | Franciszek Malinka <franciszek.malinka@gmail.com> | 2022-04-26 01:40:02 +0200 |
commit | abadc0e24d7fd1ade52e3ced31892cf5037b9cf6 (patch) | |
tree | cab5d5cc672feeb83cb16dc3fe2610b72c0db454 /src/cube.h | |
parent | 5001e89f399dbd74dab054743f95c752b6f04bc6 (diff) |
Small changes
Diffstat (limited to 'src/cube.h')
-rw-r--r-- | src/cube.h | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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 ********************************************************/ |