Results 1 to 10 of 28

Thread: Sudoku solver program, do it like a human!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #26
    PGD Staff / News Reporter phibermon's Avatar
    Join Date
    Sep 2009
    Location
    England
    Posts
    524
    Quote Originally Posted by SilverWarior View Post
    Nof if I'm not mistake this is left in in Objective Pascal as backward compatibility to the verry first days of Objective Pascal when classes still didn't have capability to automatically initialize its own members (internal fields, variables, etc.).
    I apologize for nitpicking but it must be stressed that 'Objective Pascal' (A pascal equivalent to Objective-C for using Apple Objective-C interfaces) is something quite different to 'Object Pascal' (What everybody is thinking about)

    --

    I was going to write a Monte Carlo Sudoku solver for you to demonstrate the principal (The basic premise of a Monte Carlo simulation is to converge upon an answer to a problem by using random sampling (or more generally to determine the probability distribution of an unknown value which in turn can be used to estimate the true value))

    However a search online provides an excellent approach to this technique that you can investigate : http://www.lptmc.jussieu.fr/user/talbot/sudoku.html

    Before you get your feet too wet, a good learning exercise for the Monte Carlo method is to write a program to estimate the value of Pi by using either the ratio of a circle to a square with a length equal to the diameter of the circle or the more interesting technique which is to code a virtual buffon's needle simulation and measure the ratio of needle samples that cross lines to those that fall between.

    One of the most interesting things about Monte Carlo simulations is that they become more accurate (or converge more quickly depending on the class of problem) the more 'random' your random generator is. By using a true random source of a uniform distribution you'll converge on answers more quickly or provide more accurate estimates than if you use the standard pseudo random generator provided in programming libraries. I had fascinating results (Buffon's needle Pi estimator) using a stream of true atomic random numbers as seeds for a pseudo generator. I even gained a whole decimal place of accuracy by feeding in random mouse movements (ensuring you get a good uniform distribution of samples before you re-seed - distribution of random generators and pseudo random generators in general can differ wildly, many are *not* uniform. I know that the FPC random functions are uniformly distributed but I can't vouch for Delphi)

    It's truly mind blowing when you get it and it's a lot simpler than it sounds. Plus how cool is it to say you solve sudoku puzzles using the same technique that's used to model nuclear explosions?
    Last edited by phibermon; 05-01-2015 at 06:35 PM.
    When the moon hits your eye like a big pizza pie - that's an extinction level impact event.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •