aboutsummaryrefslogtreecommitdiff
path: root/utils/solvetest_gen.sh
blob: c782ed81d77ec8dd5514082f03f4d97e0163e3e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

args="$@"

getsolutions() {
	nissy solve -p $args "$1" |
	while read -r solution; do
		printf '\t\t"%s\\n"\n' "$solution"
	done
}

printf "struct {\n\tchar *scramble;\n\tchar *solutions;\n} s[] = {\n"

i=0
while read -r scramble; do
	solutions="$(getsolutions "$scramble")"
	printf '[%s] = {\n\t.scramble = "%s",\n' "$i" "$scramble"
	printf '\t.solutions =\n%s\n' "$solutions"
	printf '},\n'
	i=$((i+1))
done

printf "};\n"

Generated with cgit - Back to sebastiano.tronto.net