Gaming TMac3000's Offical "Sudoku from Hell" Thread

TMac3000

Evil Republican
Joined
Nov 16, 2008
Messages
2,773
Reaction score
0
Points
36
Location
Flying an air liner to the moon
So, my brother introduced me to Sudoku some six or seven years ago, and I've been a big fan ever since. I'm not horrifically good at it, but I've been able to hold my own on some really tough ones.

Tough is relative, of course.

I'll be posting the hardest ones I can find here. Some of these will come from websudoku.com, and some will come from Platinum Sudoku 2 on my phone:) But I won't post any until I solve them. See if you are better than me (you probably are:lol:), and discuss!

From websudoku.com:

Code:
 ..4 ... 9..
 .19 .2. ...
 ... 16. ..2
  
 ... .57 2.1
 .6. ... .7.
 5.7 31. ...
  
 9.. .48 ...
 ... .3. 74.
 ..5 ... 8..
 
Coincidence or not, I don't know, but the school project i'll present in my final exams is a Sudoku solver!

While not myself a huge fan of those, I'll lurk around for data to feed my algorithms on... ;)
 
Tough first puzzle, TMac! sudokuslam.com rated it medium, but it took a while to break open.
 
Post the solution here, so we can see who solves it first:)
(Quote the post, and use code tags;))
Then I'll post the next one.

And yeah, I kept running into unsolvable squares in that one before I finally figured it out.
 
Code:
254   873   916
619   425   387
873   169   452

498   657   231
361   982   574
527   314   698

936   748   125
182   536   749
745   291   863
 
Coincidence or not, I don't know, but the school project i'll present in my final exams is a Sudoku solver!

While not myself a huge fan of those, I'll lurk around for data to feed my algorithms on... ;)

I've written some of these solvers in the past. SOlving the easy and medium ones is trivial, but it gets exponentially interesting as you get to the nasty edge cases. The simple eliminations come first, then the N left in N squares (forcing elimination of those N anywhere else on the block or line). Then you need to go into a recursive tree-solver, guessing and running to logical fallacy or to completion, or to another guess point. The trick is to pick the order of the guessing and the depth of the search to give an answer in a reasonable time.

What's your algorithm look like?
 
From websudoku.com:
Code:
4.. .29 .5.
9.. ..1 ...
... 6.. ..7

..5 .7. .41
..1 ... 6..
86. .3. 2..

2.. ..8 ...
... 3.. ..4
.8. 46. ..3

I use a trick I call "letter tracking" to avoid running out of clues and having to guess. Basically, you find a number that's logically forced, and mark it with an "A". Then you find the other numbers that first number implies, mark them "B", and "C", and so on. When the number you are on gives no more clues, you fall back to the one marked with the previous letter, and work from there.

The only time I ever ran completely out of clues this way, I guessed, solved the puzzle, and then found it was designed incorrectly: it had more than one solution:)
 
Last edited:
Too easy!
Code:
172 836 459
(rest left for others!)

Here's one back:

Code:
...  6..  ..8
...  .7.  ...
5..  9.8  ..4

2.5  ...  ..9
473  ...  ...
.6.  7..  2..

.3.  ..1  .82
...  3..  ...
.9.  ...  .47
 
What's your algorithm look like?

Just started it, and the point isn't much in trying to build together an algorithm, but rather in implementing one well. And we just started it (team of 3, hence the we).
The only problem is the lack of POO; as I'm first year into this the only language we can use is Javascool, which is a dumbed down Java without object programming.

I could get away with it by using two dimensional byte and boolean arrays to store the numbers and keep track of the non-changeable ones.
 
Just started it, and the point isn't much in trying to build together an algorithm, but rather in implementing one well. And we just started it (team of 3, hence the we).
The only problem is the lack of POO; as I'm first year into this the only language we can use is Javascool, which is a dumbed down Java without object programming.

I could get away with it by using two dimensional byte and boolean arrays to store the numbers and keep track of the non-changeable ones.

Here's what I would do:

1. Code up the forced simplification function first - i.e. eliminating any impossibilities for a guess-cell, setting any with just one possible answer, finding pairs, triples, etc with the same numbers (N in N possibilities) to eliminate those choices from other cells in the line or block. Make it return a "depth" value, saying how many cells it can complete with no guesses. (If it returns -1, then this path is a logical fallacy, so can be used to eliminate guesses later, or to reject the whole board if you have not yet guessed any at all).

2. From the first point where you now need to make a hypothetical move, you should calculate the highest depth for each possibility of a single guess, for each unknown cell (i.e. single recurse with the function from (1)). At this point, the top say 5 guesses are the ones to chase to the second recursion, and so on until you hit 81 (= solved). Obviously, each -1 you get back eliminates a guess from your unknown cell, and you should follow up with a run of your function again to see if it solves anything else for you.

I'm not sure if it applies perfectly, but I guess it should: have a look at Nelder Mead algorithm (that coincidentally, Enjo used in TransX for automin-finding). You want some flavor of this to hunt for the most promising depth holes to go investigate.

Now ... anti-patterns: you could conceive an initial problem that would be as hard as possible for your algorithm, and drive you close to a brute-force scan of every permutation. Have a think about how alternate search strategies (e.g. double guess, or triple random guess), might help break a pattern like that, rather than just going linearly into a worst-case scenario.


Damn ... this is almost tempting enough for me to go do another few hundred hours of coding, but I'd use C and 0MQ to parallelize it as hard as possible!
 
Too easy!
Code:
172 836 459
(rest left for others!)

Here's one back:

Code:
...  6..  ..8
...  .7.  ...
5..  9.8  ..4

2.5  ...  ..9
473  ...  ...
.6.  7..  2..

.3.  ..1  .82
...  3..  ...
.9.  ...  .47
Started on this one this morning, and it is a b:censored: indeed.
I keep my paper sudokus at the office, and I'm off for the weekend, but I'll let you know when I finish it:)
 
Started on this one this morning, and it is a b:censored: indeed.
I keep my paper sudokus at the office, and I'm off for the weekend, but I'll let you know when I finish it:)

I finished it this afternoon. I needed a double guess to complete it.
 
Code:
749 652 138
386 174 925
521 938 764

215 863 479
473 219 856
968 745 213

637 491 582
854 327 691
192 586 347

I needed a triple guess:lol:
I think I'll try this site at home:)

For 24 givens, that one was really evil. The ones on my phone usually have 22, and I'm told the lowest you can have in a proper Sudoku is 17:cheers:
 
Nice one! That was a tough challenge without computer assistance. I use Sumo mode without obvious auto-fill, so I can see the selections and solve it in the order I want.
 
From Platinum Sudoku 2, Professional level:
Code:
..5 ..3 7..
3.. 8.. 5..
... ... ..1

... 2.. ...
..1 ..4 ..2
4.. ..6 8..

... ..9 6..
..2 7.. ..8
6.. ..5 4..

Took me 6 attempts, each time going dark about a quarter of the way through, and finally a quadruple guess. If sudokuslam.com doesn't rate this Pile Driver, then I'm in the wrong business:lol:

Don't forget to post the solution when you're done;)
 
Code:
2 1 5   9 4 3   7 8 6 
3 7 6   8 1 2   5 4 9
9 8 4   6 5 7   2 3 1

7 5 3   2 9 8   1 6 4
8 6 1   5 3 4   9 7 2
4 2 9   1 7 6   8 5 3

1 3 7   4 8 9   6 2 5
5 4 2   7 6 1   3 9 8
6 9 8   3 2 5   4 1 7

I developed my own Sudoku solver as an Excel spreadsheet, if anyone is interested. (Yes, it can be done to an extent)
 
Back
Top