Sorry, Brian. I thought I’d removed the h from solveh- the h was for Hui, but not relevant for the version I prepared for this example. I had another “solve” in a larger script.
As for the dyadic version, the line below solve =: 3 : 0 , and before the : line, shows a default lhs argument to be used for a monadic application. Most lines are unaltered. Cheers, Mike Sent from my iPad > On 24 Jun 2022, at 16:43, Brian Schott <schott.br...@gmail.com> wrote: > > Mike, > > To check the inputs of a grid I found that Hui's verb 'ok' works for me. > > Your revision of the verb 'solve' looks problematic to me because it > suggests there is a dyadic version, but I could only find a monadic version > from your earlier post. Also there is an example in this post using a verb > 'solveh' that is undocumented, I believe. > > As you mention, I lean toward the tokens starting at 0, not at 1, too. > > I especially like your way of initializing the nouns such as r, c and b > based on the input shape or count. > > Also, your link to https://www.sudoku-puzzles-online.com/ was most helpful. > > > On Fri, Jun 24, 2022 at 6:34 AM 'Michael Day' via Programming < > programm...@jsoftware.com> wrote: > >> Sorry for late posting - apparently a problem with my broadband >> provider's server. >> >> Yes, it can be worth doing a limited feasibility check on your input. >> Every column, >> row and small box should have no repeated elements apart from the "missing" >> indicator, such as 0 or perhaps one of '.-*0' , eg, using my >> generalisation of Roger's code: >> */ (2 */ @: > #/.~@: -.&0)"1 R{,fiend NB. fiend is a numeric 9x9 >> puzzle >> >> 1 >> >> >> It might be of minor interest to note I've got my modification of Roger >> Hui's wiki essay >> >> code to solve a 25x25 puzzle which I lifted from an online source, >> >> https://www.sudoku-puzzles-online.com/ >> >> Annoyingly, I haven't dicovered how to download it in a form usable >> directly by J. I >> spent far too much time transcribing just one 25x25 puzzle by eye and hand. >> >> I modified the solve function , posted on 20 June. just a tad to allow >> the input of a character >> representation. I'll just reproduce the new and amended lines: >> >> solve =: 3 : 0 >> '.123456789abcdefghjklmnpqrstuvwxyzA' solve y NB. x is a default >> representation for up to 36x36 just: >> if. ' ' = 1{.0{.ry =. , y do. >> chars =. '' >> chars =. chars, /:~ ~., ' .*-' (e.~#]) ry NB. any other >> representations of unknown cells? >> chars =. chars, /:~ ~., '123456789' (+./@:e.~#[) ry >> chars =. chars, /:~ ~., 'abcdefghijklmnopqrstuvwxyz' (+./@:e.~#[) >> ry >> chars =. chars, /:~ ~., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' (+./@:e.~#[) >> ry >> sudokurep =: chars >> y =. chars i. y >> else. >> sudokurep =: x >> end. >> ..... >> see1 =: (;~n2$n1{.1)&(<;.1) @ ({&sudokurep) @ (n22&$) @ , >> >> ..... >> >> ) >> >> >> [snip] >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm