diff options
Diffstat (limited to '')
| -rw-r--r-- | src/commands.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/commands.c b/src/commands.c index d9d6b50..13405b7 100644 --- a/src/commands.c +++ b/src/commands.c | |||
| @@ -12,6 +12,7 @@ CommandArgs * scramble_parse_args(int c, char **v); | |||
| 12 | /* Exec functions ************************************************************/ | 12 | /* Exec functions ************************************************************/ |
| 13 | 13 | ||
| 14 | static void gen_exec(CommandArgs *args); | 14 | static void gen_exec(CommandArgs *args); |
| 15 | static void cleanup_exec(CommandArgs *args); | ||
| 15 | static void invert_exec(CommandArgs *args); | 16 | static void invert_exec(CommandArgs *args); |
| 16 | static void solve_exec(CommandArgs *args); | 17 | static void solve_exec(CommandArgs *args); |
| 17 | static void scramble_exec(CommandArgs *args); | 18 | static void scramble_exec(CommandArgs *args); |
| @@ -123,6 +124,15 @@ quit_cmd = { | |||
| 123 | }; | 124 | }; |
| 124 | 125 | ||
| 125 | Command | 126 | Command |
| 127 | cleanup_cmd = { | ||
| 128 | .name = "cleanup", | ||
| 129 | .usage = "cleanup SCRAMBLE", | ||
| 130 | .description = "Rewrite a scramble using only standard moves (HTM)", | ||
| 131 | .parse_args = parse_only_scramble, | ||
| 132 | .exec = cleanup_exec, | ||
| 133 | }; | ||
| 134 | |||
| 135 | Command | ||
| 126 | unniss_cmd = { | 136 | unniss_cmd = { |
| 127 | .name = "unniss", | 137 | .name = "unniss", |
| 128 | .usage = "unniss SCRAMBLE", | 138 | .usage = "unniss SCRAMBLE", |
| @@ -151,6 +161,7 @@ Command *commands[NCOMMANDS] = { | |||
| 151 | &scramble_cmd, | 161 | &scramble_cmd, |
| 152 | &steps_cmd, | 162 | &steps_cmd, |
| 153 | &twophase_cmd, | 163 | &twophase_cmd, |
| 164 | &cleanup_cmd, | ||
| 154 | &unniss_cmd, | 165 | &unniss_cmd, |
| 155 | &version_cmd, | 166 | &version_cmd, |
| 156 | }; | 167 | }; |
| @@ -499,6 +510,19 @@ quit_exec(CommandArgs *args) | |||
| 499 | } | 510 | } |
| 500 | 511 | ||
| 501 | static void | 512 | static void |
| 513 | cleanup_exec(CommandArgs *args) | ||
| 514 | { | ||
| 515 | Alg *alg; | ||
| 516 | |||
| 517 | init_moves(); | ||
| 518 | |||
| 519 | alg = cleanup(args->scramble); | ||
| 520 | print_alg(alg, false); | ||
| 521 | |||
| 522 | free_alg(alg); | ||
| 523 | } | ||
| 524 | |||
| 525 | static void | ||
| 502 | unniss_exec(CommandArgs *args) | 526 | unniss_exec(CommandArgs *args) |
| 503 | { | 527 | { |
| 504 | unniss(args->scramble); | 528 | unniss(args->scramble); |
