aboutsummaryrefslogtreecommitdiff
path: root/shell/shell.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--shell/shell.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/shell/shell.c b/shell/shell.c
index 24ae243..42b3ccd 100644
--- a/shell/shell.c
+++ b/shell/shell.c
@@ -67,6 +67,7 @@ static int64_t datasize_exec(args_t *);
67static int64_t gendata_exec(args_t *); 67static int64_t gendata_exec(args_t *);
68static int64_t solve_exec(args_t *); 68static int64_t solve_exec(args_t *);
69static int64_t solve_scramble_exec(args_t *); 69static int64_t solve_scramble_exec(args_t *);
70static int64_t countmoves_exec(args_t *);
70static int64_t help_exec(args_t *); 71static int64_t help_exec(args_t *);
71 72
72static int parse_args(int, char **, args_t *); 73static int parse_args(int, char **, args_t *);
@@ -202,13 +203,20 @@ struct {
202 "solve_scramble", 203 "solve_scramble",
203 "solve_scramble " FLAG_SOLVER " SOLVER" 204 "solve_scramble " FLAG_SOLVER " SOLVER"
204 "[" FLAG_MINMOVES " n] [" FLAG_MAXMOVES " N] " 205 "[" FLAG_MINMOVES " n] [" FLAG_MAXMOVES " N] "
205 FLAG_CUBE " CUBE", 206 FLAG_MOVES " MOVES",
206 "Solve the given SCRAMBLE using SOLVER, " 207 "Solve the given SCRAMBLE using SOLVER, "
207 "using at least n and at most N moves. " 208 "using at least n and at most N moves. "
208 INFO_MOVESFORMAT, 209 INFO_MOVESFORMAT,
209 solve_scramble_exec 210 solve_scramble_exec
210 ), 211 ),
211 COMMAND( 212 COMMAND(
213 "countmoves",
214 "countmoves " FLAG_MOVES " MOVES",
215 "Count the given MOVES in HTM. "
216 INFO_MOVESFORMAT,
217 countmoves_exec
218 ),
219 COMMAND(
212 "help", 220 "help",
213 "help [" FLAG_COMMAND " COMMAND]", 221 "help [" FLAG_COMMAND " COMMAND]",
214 "If no COMMAND is specified, prints some generic information " 222 "If no COMMAND is specified, prints some generic information "
@@ -488,6 +496,19 @@ solve_scramble_exec(args_t *args)
488} 496}
489 497
490static int64_t 498static int64_t
499countmoves_exec(args_t *args)
500{
501 long long count;
502
503 count = nissy_countmoves(args->str_moves);
504
505 if (count >= 0)
506 printf("%lld\n", count);
507
508 return count >= 0 ? 0 : count;
509}
510
511static int64_t
491help_exec(args_t *args) 512help_exec(args_t *args)
492{ 513{
493 int i; 514 int i;

Generated with cgit - Back to sebastiano.tronto.net