aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/solvetest_gen.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/solvetest_gen.sh b/utils/solvetest_gen.sh
new file mode 100755
index 0000000..c782ed8
--- /dev/null
+++ b/utils/solvetest_gen.sh
@@ -0,0 +1,23 @@
1#!/bin/sh
2
3args="$@"
4
5getsolutions() {
6 nissy solve -p $args "$1" |
7 while read -r solution; do
8 printf '\t\t"%s\\n"\n' "$solution"
9 done
10}
11
12printf "struct {\n\tchar *scramble;\n\tchar *solutions;\n} s[] = {\n"
13
14i=0
15while read -r scramble; do
16 solutions="$(getsolutions "$scramble")"
17 printf '[%s] = {\n\t.scramble = "%s",\n' "$i" "$scramble"
18 printf '\t.solutions =\n%s\n' "$solutions"
19 printf '},\n'
20 i=$((i+1))
21done
22
23printf "};\n"

Generated with cgit - Back to sebastiano.tronto.net