Hi Jim Using this <https://gist.github.com/swannodette/3217582> version of Davids solver and and the random puzzle generator you refer to the below works for me:
(sudokufd (vec (map #(if (= % \.) 0 (Integer. (str %))) (random-puzzle)))) I did adapt David's solver to work with core.logic 0.8.5, but only changes needed were due to fd being in its own namespace. Martin On Thursday, January 30, 2014 3:01:22 PM UTC+1, Jim foo.bar wrote: > > Hi all, > > I think we are all familiar with the wonderful core.logic implementation > of a sudoku solver by David Nolen. Now, I am trying to combine his solver > with the `random-puzzle` generator shown here ( > http://jkkramer.com/sudoku.html). I have made the necessary changes (to > deal with seqs of numbers rather than strings and to return 0 instead `.` > for empty squares) but doing `(solve (random-puzzle))` eats up memory > without returning anything, whereas trying out some of the ready made > puzzles shown as examples on the above link works! > > I suspected a different board representation between the 2 projects but > then I noticed that the ready-made examples work in both implementations so > it can't be that...both implementations seem to accept a 1D seq of either > strings or numbers. > > any clues? I'd like to be able to generate random-puzzles that can be > passed to the core.logic solver. Currently `(random-puzzle)` returns > something like this which at first glance seems compatible with David's > solver: > > user=> (random-puzzle 17) > (0 0 0 0 0 2 0 0 6 8 0 0 0 0 0 0 0 0 0 0 0 5 0 0 0 0 7 0 0 0 0 0 0 3 0 8 2 > 0 0 0 0 0 0 0 1 0 0 0 3 0 0 0 0 2 7 0 0 0 5 0 8 0 3 0 2 0 0 0 0 0 0 4 0 0 0 > 0 0 0 0 0 0) > user=> (count (filter (complement zero?) *1)) > 17 > > has anyone looked at both projects? > > thanks in advance :) > > Jim > > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.