Sudoku Solver in 140 bytes
Solve a Sudoku grid only using magic, recursion, and 140bytes of brute force.
This entry was inspired and built on top of the itsy bitsy shoulders of the smallest sudoku solvers in Perl (120b), Ruby (122b), Python (178b), ...
Credits go this way:
166b @p01 .......... initial implementation
147b @p01 .......... initial golf
146b @qfox ......... loop optimization
145b @qfox ......... output with closured callback
140b @p01 .......... output with hijacked Array.prototype.toString()
141b @maksverver ... fixed the glitchy j^i==j test
140b @fgnass ....... ReferenceError exit trick + cross browser fix
Thanks to everyone who helped golf and fix this puppy.
Oh, I only see now that you're adding sugar for the
toString
"callback" in the test. I hadn't seen that before, just read the comments. That's why I was confused by the||+a
part. If you modifytoString
, the rules obviously change.So I can see what you mean, but do you think this would be possible or acceptable in a js1k? I'd think the (temporary)
toString
modification is boiler plate, but still required for the solution. Guess what I'm asking is, do you really think this is a proper 140b entry, or should the toString modification actually kind of be part of it. Especially when golfing, I think it matters. And I think it does. Just my two cents... :)