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

gentranscode.sh (670B)


      1 #!/bin/sh
      2 
      3 cc -DDEBUG h48_to_lst.c ../src/nissy.c -o h48_to_lst
      4 cc -DDEBUG invert.c ../src/nissy.c -o invert
      5 
      6 lineavx() { printf '#define _trans_cube_%s ' "$1"; }
      7 linesrc() { printf '_static cube_fast_t _trans_cube_%s = ' "$1"; }
      8 sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; }
      9 sedsrc() { sed '3s/$/ };/ ; 3q'; }
     10 
     11 gen() {
     12 	for f in cubes/transform_??_???.txt; do
     13 		trans="$(echo "$f" | sed 's/.*_// ; s/\.txt//')"
     14 		printf '#define _trans_cube_%s fastcube( \\\n    ' "$trans"
     15 		./h48_to_lst <"$f"
     16 		printf ')\n'
     17 		printf '#define _trans_cube_%s_inverse fastcube( \\\n    ' \
     18 			"$trans"
     19 		./invert <"$f" | ./h48_to_lst
     20 		printf ')\n'
     21 	done
     22 }
     23 
     24 gen
     25 rm -f h48_to_lst invert