logicpuzzle

A LaTeX style file for typesetting logic puzzles

User Tools

Site Tools


createlpsudoku

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
createlpsudoku [2013/03/18 16:40]
kleberj
createlpsudoku [2015/09/06 09:51] (current)
Line 28: Line 28:
 # #
 FORMAT="​81"​ FORMAT="​81"​
-VERSION="​v1.0"+VERSION="​v1.1"
 LINEENDINGS="​UNIX"​ LINEENDINGS="​UNIX"​
 IFILE=""​ IFILE=""​
Line 71: Line 71:
 then then
   echo "​\begin{lpsudoku}"​   echo "​\begin{lpsudoku}"​
-  for SDLINE in `cat $IFILE | sed -e '​1d'​ -e'​5d'​ -e'​9d'​ -e'13,20d' | sed -e '​s/​|//​g'​ | sed -e's/^ //g'`+  for SDLINE in `cat $IFILE | sed -e '​1d'​ -e'​5d'​ -e'​9d'​ -e'13,200d' | sed -e '​s/​|//​g'​ | sed -e's/^[[:space:]]//g'`
   do   do
-    ROWARG=`echo $SDLINE | sed -e'​s/​\./​{},/​g'​ -e's/1/1,/g' -e'​s/​2/​2,/​g'​ -e'​s/​3/​3,/​g'​ -e'​s/​4/​4,/​g'​ -e'​s/​5/​5,/​g'​ -e'​s/​6/​6,/​g'​ -e'​s/​7/​7,/​g'​ -e'​s/​8/​8,/​g'​ -e'​s/​9/​9,/g' | sed -e'​s/,​$//'​`+    ROWARG=`echo $SDLINE | sed -e'​s/​\./​{},/​g'​ -e's/\([[:​digit:​]]\)/\1,/g' | sed -e'​s/,​$//'​`
     echo " ​ \setrow{$COUNT}{$ROWARG}"​     echo " ​ \setrow{$COUNT}{$ROWARG}"​
     ((COUNT--)) ​     ((COUNT--)) ​
Line 89: Line 89:
     do     do
       SDLINE=`echo $SUDOKU | cut -c${SLBEGIN}-${SLEND}`       SDLINE=`echo $SUDOKU | cut -c${SLBEGIN}-${SLEND}`
-      ROWARG=`echo $SDLINE | sed -e'​s/​\./​{},/​g'​ -e's/1/1,/g' -e'​s/​2/​2,/​g'​ -e'​s/​3/​3,/​g'​ -e'​s/​4/​4,/​g'​ -e'​s/​5/​5,/​g'​ -e'​s/​6/​6,/​g'​ -e'​s/​7/​7,/​g'​ -e'​s/​8/​8,/​g'​ -e'​s/​9/​9,/g' | sed -e'​s/,​$//'​`+      ROWARG=`echo $SDLINE | sed -e'​s/​\./​{},/​g'​ -e's/\([[:​digit:​]]\)/\1,/g' | sed -e'​s/,​$//'​`
       echo " ​ \setrow{$COUNT}{$ROWARG}"​       echo " ​ \setrow{$COUNT}{$ROWARG}"​
       ((COUNT--))       ((COUNT--))
createlpsudoku.txt ยท Last modified: 2015/09/06 09:51 (external edit)