aboutsummaryrefslogtreecommitdiff
path: root/utils/genmovecode.sh
blob: 25ad0396e3938088b788409f9c15693720f693be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

gcc -DDEBUG h48_to_lst.c ../cube.c -o h48_to_lst

gen() {
	for f in move_??_*.txt; do
		move="$(echo $f | sed 's/.*_// ; s/\.txt//')"
		lst="$(./h48_to_lst <$f)"
		c="$(echo $lst | cut -d ' ' -f -8 | rev | cut -c 2- | rev)"
		e="$(echo $lst | cut -d ' ' -f 9-)"
		printf '[%s] = {\n' "$move"
		printf '\t.corner = {%s},\n' "$c"
		printf '\t.edge = {%s}\n' "$e"
		printf '},\n'
	done
}

gen
rm -f h48_to_lst invert

Generated with cgit - Back to sebastiano.tronto.net