Closed xuanwu closed 9 years ago
Thank you for bringing this to my attention!
You are correct. The code expects the vars
parameter to all_pairs
, all_same
, and all_different
to be an array, not variable arguments (splat): the Sudoku and Mathdoku classes use CSP#all_different
in this way.
I have updated the API reference to reflect the current state of the code.
That said, which way do you think would be better? Splats or Arrays?
I think splats would be more convenient and natural for hand-coded CSP's, but the presently-used arrays are more convenient for coding (no extra step to convert from an array to a splat).
I'm just happy to see others using this library. :-)
Thanks for the quick response!
I actually like arrays better than splats, since I'm generating the variables dynamically.
I have a separate question. Should I create a new issue for it? Or can I email you directly?
Apologies for the delayed response this time.
Either way is fine with me. If you think other people might have the same question, I'd recommend creating a new issue.
I'll go ahead and close this issue. If you have any more questions or concerns, feel free to reopen it.
Hi, thanks for writing this library!
In the API reference at http://komputerwiz.net/apps/csp-solver, it shows
all_pairs
,all_same
, andall_different
as having a splat operator in the argument, but the source code doesn't have it. I assume that instead of callingcsp.all_different(:x, :y, :z)
for example, it should becsp.all_different([:x, :y, :z])
, correct?Thanks again!