Changing module variables.

Albert van der Horst albert at spenarnc.xs4all.nl
Tue Jan 29 08:37:49 EST 2008


I have made a sudoku solver, and discovered I simply 
can turn it into a hexadoku solver, like so:
_______________________________
# sudoku solver using sets
import sudoku

sudoku.symbols="0123456789ABCDEF"
sudoku.size=16 
sudoku.sqs=4 # square root of size .
_______________________________

Example of usage:


_______________________________
y=sudoku.sudoku(
   "    " "  B "  "95E " "8 1C"
   " 9 7" " 1 C"  " 8 B" "A 46"
   "  4 " "0  8"  "  71" "3 59"
   " C 8" "7F  "  "A 24" "BD  "

   " 7  " "4  1"  "   5" "    " 
   "42  " "   0"  " BAC" "   1"
   "8 6A" "F  5"  "2 9 " "  D "
   "    " "C28 "  " 1 7" "  9 "

   " A3 " "    "  " E  " " 5 B" 
   "08 E" "B C "  " 96 " "1A3 "
   "D 5 " "    "  "0  A" "   E"
   "6  1" " A F"  "5DC2" "   8"

   " 58 " "3C  "  "   6" "41AD" 
   "1E 6" "542 "  " 73D" " 08F"
   "B3  " " 8  "  "14  " "  67"
   "240D" "16F "  "  8 " "   3"

)


y.show()
y.solve()
y.show()

_______________________________

I like this. It certainly is reusability.
                                              
Still I wonder what you guys think of this?
(I know some OO-boys who would spank me for it.)

Groetjes Albert

-- 

-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- like all pyramid schemes -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst



More information about the Python-list mailing list