aboutsummaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/commands.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/commands.c b/src/commands.c
index 56ff944..02af19f 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -2,12 +2,12 @@
2 2
3/* Arg parsing functions *****************************************************/ 3/* Arg parsing functions *****************************************************/
4 4
5CommandArgs * solve_parse_args(int c, char **v);
6CommandArgs * gen_parse_args(int c, char **v); 5CommandArgs * gen_parse_args(int c, char **v);
7CommandArgs * help_parse_args(int c, char **v); 6CommandArgs * help_parse_args(int c, char **v);
8CommandArgs * print_parse_args(int c, char **v); 7CommandArgs * print_parse_args(int c, char **v);
9CommandArgs * parse_only_scramble(int c, char **v); 8CommandArgs * parse_only_scramble(int c, char **v);
10CommandArgs * parse_no_arg(int c, char **v); 9CommandArgs * parse_no_arg(int c, char **v);
10CommandArgs * solve_parse_args(int c, char **v);
11 11
12/* Exec functions ************************************************************/ 12/* Exec functions ************************************************************/
13 13
@@ -17,6 +17,7 @@ static void solve_exec(CommandArgs *args);
17static void steps_exec(CommandArgs *args); 17static void steps_exec(CommandArgs *args);
18static void commands_exec(CommandArgs *args); 18static void commands_exec(CommandArgs *args);
19static void print_exec(CommandArgs *args); 19static void print_exec(CommandArgs *args);
20static void twophase_exec(CommandArgs *args);
20static void help_exec(CommandArgs *args); 21static void help_exec(CommandArgs *args);
21static void quit_exec(CommandArgs *args); 22static void quit_exec(CommandArgs *args);
22static void unniss_exec(CommandArgs *args); 23static void unniss_exec(CommandArgs *args);
@@ -93,6 +94,15 @@ help_cmd = {
93}; 94};
94 95
95Command 96Command
97twophase_cmd = {
98 .name = "twophase",
99 .usage = "twophase",
100 .description = "Find a solution quickly using a 2-phase method",
101 .parse_args = parse_only_scramble,
102 .exec = twophase_exec,
103};
104
105Command
96quit_cmd = { 106quit_cmd = {
97 .name = "quit", 107 .name = "quit",
98 .usage = "quit", 108 .usage = "quit",
@@ -128,6 +138,7 @@ Command *commands[NCOMMANDS] = {
128 &quit_cmd, 138 &quit_cmd,
129 &solve_cmd, 139 &solve_cmd,
130 &steps_cmd, 140 &steps_cmd,
141 &twophase_cmd,
131 &unniss_cmd, 142 &unniss_cmd,
132 &version_cmd, 143 &version_cmd,
133}; 144};
@@ -384,6 +395,22 @@ print_exec(CommandArgs *args)
384} 395}
385 396
386static void 397static void
398twophase_exec(CommandArgs *args)
399{
400 Cube c;
401 Alg *sol;
402
403 init_movesets();
404 init_symcoord();
405
406 c = apply_alg(args->scramble, (Cube){0});
407 sol = solve_2phase(c, 1);
408
409 print_alg(sol, false);
410 free_alg(sol);
411}
412
413static void
387help_exec(CommandArgs *args) 414help_exec(CommandArgs *args)
388{ 415{
389 if (args->command == NULL) { 416 if (args->command == NULL) {

Generated with cgit - Back to sebastiano.tronto.net