Quote Originally Posted by phibermon View Post
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?
Thanks, when I'll have more time I'm going to look at it. Problem is that I don't know shit about C, and these variable names like "is" and "jb" are just too confusing, they say nothing about what it means so it makes it even more difficult for me to understand what the program does.