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 <[email protected]> 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" <[email protected]> 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