[Jprogramming] Jolf
Raul Miller
rauldmiller at gmail.com
Sun Aug 21 01:18:52 UTC 2016
Er... for something like this, I would probably start with one of Roger's
implementations from http://code.jsoftware.com/wiki/Essays/N_Queens_Problem
#;:queenst f. 1 :'5!:5<''u'''
42
Looks like yours is more concise though.
I hope this helps...
--
Raul
On Sat, Aug 20, 2016 at 6:49 PM, Louis de Forcrand <olius at bluewin.ch> wrote:
> Alrighty then.
>
> Let’s start this off with a couple of rules:
> - We can either count characters or tokens; I suggest tokens.
> Either one should be counted on fixed (f.) functions.
> - Programs can be restricted to either tacit or explicit, or not.
> In the latter case counting tokens would be ambiguous, so I
> don’t think the two should be used together.
>
> Of course this could change from task to task, and should be clarified
> at the beginning of new challenges.
> I won’t be coming up with all of the challenges; you should make some
> up too.
>
>
> Without further ado, here is a simple first challenge:
> Write a verb which takes a scalar N, and returns all solutions to the
> N-Queens problem in the form of a rank-2 array of rank-1 permutation
> vectors. Given a vector V, the queens’ coordinates are:
>
> (,.~ i.@#) V
>
> This can be done because we know that no two queens can be
> placed on the same row.
>
> I suggest counting tokens of tacit solutions using this verb:
>
> scr=: #@;:@(5!:5) NB. score verb: scr ‘foo’ ; ‘bar’ ; ‘baz’
>
> If you have a better suggestion for scoring or rules, feel free to chime
> in.
> In addition, if you feel your version is particularly elegant, or
> efficient,
> or posses any other attribute you deem worthy, please share it with us,
> even if it is does not have an especially low score.
>
> I will be posting my contender soon.
>
> Cheers,
> Louis
>
>
> > On 20 Aug 2016, at 21:47, Joe Bogner <joebogner at gmail.com> wrote:
> >
> > Hi! Welcome. I think this is the right place.
> >
> > Source: http://www.jsoftware.com/forums.htm
> >
> > On Aug 20, 2016 3:35 PM, "Louis de Forcrand" <olius at bluewin.ch> wrote:
> >
> >> Hi everyone,
> >>
> >> Would this be the appropriate place for some Jolfing (J code golfing),
> >> or is there a better place for this?
> >>
> >> Thanks,
> >> Louis
> >>
> >> ----------------------------------------------------------------------
> >> 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
More information about the Programming
mailing list