[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-apl] Quad-DLX implementation of Sudoku soon
From: |
Christian Robert |
Subject: |
[Bug-apl] Quad-DLX implementation of Sudoku soon |
Date: |
Thu, 1 Dec 2016 22:10:16 -0500 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
Not a bug report,
Left arg of GenGRID is maximum number of seconds to run (arg is optional and
default to 30 secs)
Right arg of GenGRID is the target maximum number of non-zero digits in the
grid (stopped by timer on the left side)
// generate a random grid and try for the next 60 seconds to reduce it into a
20 non empty cells.
Display a←60 GenGRID 20
╔═══╤═══╤═══╦═══╤═══╤═══╦═══╤═══╤═══╗
║ 4 │ │ 5 ║ │ │ 2 ║ │ 7 │ 1 ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ │ │ ║ │ │ ║ │ │ ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ │ │ 9 ║ │ 4 │ ║ │ │ 6 ║
╠═══╪═══╪═══╬═══╪═══╪═══╬═══╪═══╪═══╣
║ │ │ ║ 9 │ │ ║ 8 │ │ ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ │ 3 │ ║ │ │ 6 ║ │ 4 │ ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ │ │ ║ │ │ ║ 3 │ │ ║
╠═══╪═══╪═══╬═══╪═══╪═══╬═══╪═══╪═══╣
║ │ 1 │ ║ │ 6 │ ║ │ 8 │ ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ │ 7 │ ║ │ 2 │ 1 ║ │ │ ║
╟───┼───┼───╫───┼───┼───╫───┼───┼───╢
║ │ │ 8 ║ │ │ ║ │ │ ║
╚═══╧═══╧═══╩═══╧═══╧═══╩═══╧═══╧═══╝
Took 60.37293294 secs (failed at reducing to 20, final was 21)
a
4 0 5 0 0 2 0 7 1
0 0 0 0 0 0 0 0 0
0 0 9 0 4 0 0 0 6
0 0 0 9 0 0 8 0 0
0 3 0 0 0 6 0 4 0
0 0 0 0 0 0 3 0 0
0 1 0 0 6 0 0 8 0
0 7 0 0 2 1 0 0 0
3 0 8 0 0 0 0 0 0
One of the hardest Sudoku you can dream of (I think) but still solvable.
I got Lucky, because very few initial grids can be reduced as much as that ...
Will post my Sudoku workspace later when I'm satisfied with his behavior and
speed.
Xtian.
- [Bug-apl] Quad-DLX implementation of Sudoku soon,
Christian Robert <=