nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

solvetest_gen.sh (620B)


      1 #!/bin/sh
      2 
      3 # use like e.g.
      4 # nissy scramble -n 20 | ./utils/solvetest_gen.sh eofb -o -N | \
      5 #     tee tools/401_solvetest_opt0_EO_FB/scrambles.h
      6 
      7 args="$@"
      8 
      9 getsolutions() {
     10 	nissy solve -p $args "$1" |
     11 	while read -r solution; do
     12 		printf '\t\t"%s\\n"\n' "$solution"
     13 	done
     14 }
     15 
     16 printf "struct {\n\tchar *scramble;\n\tchar *solutions;\n} s[] = {\n"
     17 
     18 i=0
     19 while read -r scramble; do
     20 	solutions="$(getsolutions "$scramble")"
     21 	printf '[%s] = {\n\t.scramble = "%s",\n' "$i" "$scramble"
     22 	printf '\t.solutions =\n%s\n' "$solutions"
     23 	printf '},\n'
     24 	i=$((i+1))
     25 done
     26 
     27 printf '{\n\t.scramble = "", /* End-of-list signal */\n}\n};\n'