Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  while (!isSolved(sudoku)) {
    sudoku = generateNextPermutation(sudoku);
  }
Solved (eventually).


A bogosolver is a valid approach. I mean it'll take forever, but it's valid.


You can solve it via brute force if you cut off branches that don't satisfy the rules:

https://github.com/tonyedgecombe/Sudoku/blob/master/Sudoku/P...

It's not 1ms but it's not that slow either.


I plead the halting problem.


There are a limited number of permutations. Assuming it's not choosing them randomly, it'll finish eventually... If the hardware doesn't die first.




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

Search: