[Dose-devel] dose sudoku

Johannes Schauer j.schauer at email.de
Mer 18 Déc 13:07:33 CET 2013


Hi,

just an hour ago I found this ancient (2008) blog post about solving sudoku
with aptitude:

http://algebraicthunk.net/~dburrows/blog/entry/package-management-sudoku/

So I thought: hey, surely dose3 can do better than aptitude here!

And now you can do:

$ curl http://mister-muffin.de/p/iS_Y > dosesudoku.py
$ curl http://algebraicthunk.net/~dburrows/blog/entry/attachments/debsudoku.py > debsudoku.py
$ curl http://mister-muffin.de/p/4pcJ.txt > ksudokuboard.xml
$ python debsudoku.py --mode=print ksudokuboard.xml
+---+---+---+                                    
| 2 | 9 | 68|
|3  |7  |1  |
|   |  2|4  |
+---+---+---+
| 6 |5  |2 9|
|9  |   | 8 |
|  3|   |  4|
+---+---+---+
| 95|2  |   |
|2  | 8 | 5 |
|4  |3 5|   |
+---+---+---+
$ python debsudoku.py --mode=conflicts ksudokuboard.xml > Packages
$ dose-distcheck --explain --successes --checkonly puzzle deb://Packages | python dosesudoku.py
+---+---+---+
|724|193|568|
|358|746|192|
|619|852|437|
+---+---+---+
|861|534|279|
|942|671|385|
|573|928|614|
+---+---+---+
|195|267|843|
|236|489|751|
|487|315|926|
+---+---+---+

Nothing surprising and nothing fancy but maybe reading this gives you a similar
amount of entertainment during your lunch break as I had during mine :)

As a surprising side note: generating the Packages file such that the sudoku
board is encoded with package Depends instead of Conflicts makes dose3 quit
with the message:

    The applications raised this exception : Stack overflow

Maybe distcheck should give a non-zero exit status here?

cheers, josch



More information about the Dose-devel mailing list