Raul,

This is fascinating and compact code for part 2.
You are using (;.3} tesselation shards very cleverly.
I have  not quite figured out your method, and am mostly wondering how
you are forcing the order of tesselation steps to conform to the spiral
sequence in the array.

[Ignore ALL the comments below because I found the error in using debug on
`steps`
was the "0 in its definition line. When I omitted "0, it debugs fine]

I first tried unsuccessfully to use debug to understand the simpler code in
part 1 of
the monad `steps`. But I could not even set a stop on line 1, only on line
0 {see below}. So I
gave up there, early on.

   load'debug'
   dbss 'steps 1'
   dbr 1
   steps 23
2



On Mon, Dec 4, 2017 at 8:03 AM, Raul Miller <[email protected]> wrote:

> And... speaking of spiral neighbors -- yeah... not paying attention...
> and that looks like an inductive thing...
>
> So...
>
> spiral =: ,~ $ [: /: }.@(2 # >:@i.@-) +/\@# <:@+: $ (, -)@(1&,)
> aspiral=: (*: - spiral)@>.@%:
> coord=: $@] #: I.@,@e.~
>
> steps=:3 :0"0 NB. part 1
>   as=. aspiral y
>   +/|-/(1,y) coord as
> )
>
> fibspi=:3 :0"0 NB. part 2
>   as=. <:aspiral y+25
>   seq=. ;(],+/@:{) ::]L:0/|.1; }.(/:,as) {&, _1 _1|.3 3 <@(#~ ] <4&{
> ::_)@,;.3 as
>   seq{~(seq <:y)i.0
> )
>
> Beware email induced line wrap (if you see an explicit line which is
> not the last line and which is not an assignment, it's really part of
> the previous line).
>
> Probably can be simplified... and painfully slow.
>
> Now to go back and read whether anyone already posted this and I guess
> try things and see which approaches are faster...
>
> Sorry about the noise,
>
> --
> Raul
>
>
>
> On Mon, Dec 4, 2017 at 7:11 AM, Raul Miller <[email protected]> wrote:
> > Hmmm... actually, my spiral was oriented "wrong" - which doesn't
> > matter, which means that I did not need the |."1 in it...
> >
> > Anyways... looks like I was not paying enough attention...
> >
> > --
> > Raul
> >
> >
> > On Mon, Dec 4, 2017 at 7:05 AM, Raul Miller <[email protected]>
> wrote:
> >> I used Eugene's approach, also:
> >>
> >> spiral =: ,~ $ [: /: }.@(2 # >:@i.@-) +/\@# <:@+: $ (, -)@(1&,)
> >> aspiral=: (*: - |."1@spiral)@>.@%:
> >> steps=:3 :0"0
> >>   as=. aspiral y
> >>   +/|-/(($as)#:I.,1=as),($as)#:I.,y=as
> >> )
> >>
> >>    steps 1 12 23 1024
> >> 0 3 2 31
> >>
> >> FYI,
> >>
> >> --
> >> Raul
> >>
> >> On Mon, Dec 4, 2017 at 2:02 AM, Brian Schott <[email protected]>
> wrote:
> >>> I have only worked on part 1 so far.
> >>> All my verbs are monadic and take the number in question as its
> argument.
> >>>
> >>>
> >>>    evenQ =. = <.&.-:
> >>>    size =. (+evenQ)@>.@%:              NB. edge length
> >>>    border =. size-&*:_2+size           NB. border length (number)
> >>>    lowest =. 1 _3 4& p. @ -:@<:@size   NB. border's number which needs
> >>> lowest # of moves
> >>>    least4 =. lowest+ (i. 4)*4%~border  NB. border's 4 lowest # of moves
> >>>    least =. -:@<:@size                 NB. least # of moves
> >>>    addto =: least4<./@:(|@-)]          NB. additional # of moves
> >>>    total =. least + addto
> >>>    total"0]1 12 23 1024
> >>> 0 3 2 31
> >>>
> >>> I found the polynomial in `lowest` by studying the pattern of numbers
> 1  2
> >>>  11  28 53
> >>> as follows. (The fact that the 2nd differences are constantly 8 lead
> me to
> >>> the
> >>> solution.)
> >>>
> >>>    2-/\(^: 0 1 2)1 _3 4 p. i. 5
> >>>  1  2  11  28 53
> >>> _1 _9 _17 _25  0
> >>>  8  8   8   0  0
> >>>
> >>>
> >>> I had seen Eugene's evolute and now WRAP, so maybe the second part is
> >>> doable, but I'm tired.
> >>>
> >>> --
> >>> (B=) <-----my sig
> >>> Brian Schott
> >>> ----------------------------------------------------------------------
> >>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to