Hi list,
I am trying to use the CLP(FD) library to model valid configurations of
ships in the classic Battleship game
(
http://en.wikipedia.org/wiki/Battleship_%28game%29).
I would like to iterate over all possible configurations and create a
histogram function that tells me for each field in the board the number
of valid configurations that involve this particular field.
This may not be a particularly brilliant idea; it's just the first thing
that came to my mind ;-)
My problem is this: the number of possible configurations seems to be
huge, so iterating all of them might not be feasible. (I tried counting
them using aggregate/3 but I aborted after a couple of minutes.)
Now I am wondering: is there a way to somehow tell the labeling
algorithm to pick solutions in random order? This would help, because
then I could build an arbitrarily precise approximation based on a
random sample of solutions.
Or is there maybe some way that I can efficiently skip over the first N
solutions? The idea here would be that I could implement the random
sampling myself, at least if I can somehow find out the total number of
solutions.
Kind Regards,
--lu