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

gentranstests.sh (1028B)


      1 #!/bin/sh
      2 
      3 outdir="./generated_trans_tests"
      4 
      5 mkdir -p "$outdir"
      6 i=100
      7 
      8 while read -r line; do
      9 	[ -z "$line" ] && continue
     10 
     11 	trans_piece="$(echo "$line" | awk '{print $1}' | tr -d 'rm')"
     12 	move1="$(echo "$line" | awk '{print $2}')"
     13 	move2="$(echo "$line" | awk '{print $3}')"
     14 
     15 	rotation="rotation $trans_piece"
     16 
     17 	file1="$(ls cubes | grep "move_.*_${move1}.txt")"
     18 	file2="$(ls cubes | grep "move_.*_${move2}.txt")"
     19 	echo "$rotation" >"$outdir/${i}_${trans_piece}r_${move1}.in"
     20 	cat "cubes/$file1" >>"$outdir/${i}_${trans_piece}r_${move1}.in"
     21 	cp "cubes/$file2" "$outdir/${i}_${trans_piece}r_${move1}.out"
     22 
     23 	i=$((i+1))
     24 
     25 	mirrored="mirrored $trans_piece"
     26 	move2m="$(echo "${move2}" | tr 'LR' 'RL')3"
     27 
     28 	file1="$(ls cubes | grep "move_.*_${move1}.txt")"
     29 	file2="$(ls cubes | grep "move_.*_${move2m}.txt")"
     30 	echo "$mirrored" >"$outdir/${i}_${trans_piece}m_${move1}.in"
     31 	cat "cubes/$file1" >>"$outdir/${i}_${trans_piece}m_${move1}.in"
     32 	cp "cubes/$file2" "$outdir/${i}_${trans_piece}m_${move1}.out"
     33 
     34 	i=$((i+1))
     35 done <transform_moves.txt