h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

gentransswitch.sh (334B)


      1 #!/bin/sh
      2 
      3 printf '\tswitch (t) {\n'
      4 for f in cubes/transform_??_???.txt; do
      5 	t="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
      6 	mirror_or_rotation="$(echo "$t" | grep m)"
      7 	if [ -z "$mirror_or_rotation" ]; then
      8 		m="rotation"
      9 	else
     10 		m="mirrored"
     11 	fi
     12 	printf '\tcase %s:\n\t\treturn _trans_%s(%s, c);\n' "$t" "$m" "$t"
     13 done
     14 printf '\t}\n'