I'm not sure I understand your opening comment here. Specifically:
solitaire 0 14 13 12 11 12 13 3 7 12 10 6 3 13 12 11 9 8 7 1 3 6 5 4 3 11 7 4 6 3 1 0 2 5 5 4 3 3 1 0 solitaire 10 14 9 5 2 5 9 12 8 5 9 5 2 10 11 12 13 12 11 1 4 8 11 7 4 6 3 1 2 4 7 8 7 6 0 1 3 3 6 10 solitaire 14 0 1 3 6 3 1 12 7 3 14 13 12 9 8 7 2 5 9 1 3 6 6 7 8 9 8 7 11 12 13 4 7 11 10 11 12 12 13 14 (This is with a non-shuffling implementation of search.) If you're not getting this, it might be worth looking at where your intermediate results start conflicting with the ones I've shown here? Thanks, -- Raul On Tue, Jun 6, 2017 at 8:53 AM, Michael Rice <[email protected]> wrote: > For a starting state of positions 0 10 and 14 empty, I can hear my AMD > FX-8320's fan crank up for about 10 second before returning "No Solution." > > The base example for my peg solitaire endeavors was from "Prolog By > Example" by Coelho & Cotta, pg. 132. > > Here's a nice presentation of representing the problem with Clojure. Just > click on Chapter 5 and scroll down to "Peg Thing." In Clojure, maps are > like Lisp's hash-tables, associative data structures. > > http://www.braveclojure.com/functional-programming/ > > > On Tue, Jun 6, 2017 at 6:11 AM, 'Mike Day' via Programming < > [email protected]> wrote: > >> My point being, if Michael Rice is exploring how to solve peg solitaire, >> it's often useful to work on small(er) problems, before perhaps getting >> stuck in a long loop, or seeing the memory climb and one's pc seize up >> and need rebooting. >> >> But he'll know all this stuff anyway! >> >> BTW, re Raul's useful thoughts on union matters, same thread, earlier post. >> I've just noticed that the intersection I posted, ix = [-.-. , is, >> perhaps, "lazy"; >> better might be ~.@([-.-.), but neither is appropriate for bit-vector >> comparisons! >> >> Cheers, >> Mike >> >> >> On 06/06/2017 10:28, Raul Miller wrote: >> >>> On Tue, Jun 6, 2017 at 4:09 AM, 'Mike Day' via Programming >>> <[email protected]> wrote: >>> >>>> if I were developing a solver for solitaire, I'd include a variable as a >>>> parameter for >>>> >>>> the size of problem, eg the number of rows, 1 2 3 etc, or the >>>> ravel-size, >>>> eg 1 3 6 etc. >>>> >>> You had not specified that previously, but note that implementing this >>> is a simple change. >>> >>> For example: >>> >>> flip=: [ ~: i.@#@[ e. ] >>> >>> solitaire=:3 :0 >>> 5 solitaire y >>> : >>> path=. (y flip~ 1#~ 0 0.5 0.5 p. x) search i.0 3 >>> if. #path do. path else. 'No solution' end. >>> ) >>> >>> That said, the 'No solution' cases require a time-consuming exhaustive >>> search, and in the few tests I did with sizes other than 5, I was >>> hitting no solution cases. It's time consuming because each >>> permutation of moves that leads to a final board state gets tested. >>> >>> Still, I hope this helps, >>> >>> >> >> --- >> This email has been checked for viruses by Avast antivirus software. >> https://www.avast.com/antivirus >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
