Hacker Newsnew | past | comments | ask | show | jobs | submit | alienDeveloper's commentslogin


Well the constraint propagation is quite good. My logic adds one more constraint.

If any of the possible values of a cell is not possible in any of the other conflicting cell than its safe to assume that, that value is the value of this cell.

hope its not confused. check the line 313 to 386 of my code.


The bit you're missing is not the propagation, it's the memoisation. Roughly summarised, norvig's alrogithm is:

1. Construct a 9x9 Array of possibility arrays containing the numbers 1-9. 2. When a possibility array is reduced to 1 element, remove this number from all related arrays (row, column, box). 3. Reduce the arrays to 1 number as specified by the initial puzzle. 4. If, after propagation all possibility arrays have 1 item, the puzzle is solved 5. Otherwise,choose one of the shortest possiblity arrays and try a value, backtrack if this leads to an unsolvable puzzle

The key points are the memoisation of possiblities, and choosing cells with the smallest number of possibilities for the search.


because brute-force executes very quickly for easy sudoku's but as it gets harder and lesser values are provided it takes too much time.


I have a suduko solver. It is what I consider "brute force", though it does not look any further down boards that do not satisfy the constraints of the game (i.e. values unique in rows, columns, 9-cells). Typically it executes in < 0.5 seconds. Can you supply a "hard" puzzle that will take too much time?

A legal puzzle must have only one valid solution.

Update: I googled for a hard sudoku board, got http://www.forbeginners.info/sudoku-puzzles/hard-1.htm It was brute-forced in 0.038 seconds on my laptop. Code is here: http://github.com/AnthonySteele/SudokuSolver/commit/b953ef97...


this is not a brute force trick.. it calculate all possibilities and eliminate others using constraint theories.


thankyou .. i have asked on stack exchange code review.

http://codereview.stackexchange.com/q/1489/2879


do they have any kind of ip or patent rights on this model? I belive i have a bit more advanced version of this model for some time now. But was not on Gym, but similar. Still my idea too goes very well with this Gym.

Does anyone know if it cause any problems, if i procced with my ideas?


i say $55 billion Dollars will do the job. ;) i really like the titles "Sir" and "The wealthiest man in the world" .. I hope im not day dreaming .. again.. :)


Well i already know php to some extend, and the basics of C/CPP, Java, Action Script and all..

But i really like to get my hands dirty on C/CPP(im working on a MySQL storage engine as a hobby) and i like to learn python( i like maya[Animation], not only that python is a very strong language) too .. Those are the 2 currently in my list..

And if u want me to chose one more.. i say Java, because it will give me a very strong background on some very kewl concepts which i can use in other languages.. :)

And about my natural languages..

I definitely like to learn Sanskrit because their is a lot of knowledge hidden in Sanskrit books which u can never find else where, then i like to learn Chinese because i like the way its pronounced. and finaly spanish because.. well their is no because for that.. i just like to learn thats all.. :)

actually its harder than i thought it will be to reason why you learn a natural language other than if you are going to visit the related country or you are dating someone from that country ;) ..


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: