This can't be right.

10 s 4 se gets a distance of 10.
But 10 se 4 ne gets a distance of 14.

I suppose I should point out this issue about that algorithm, on that
subreddit, but I guess that can wait until I get home (and maybe think
about this some more).

Thanks,

-- 
Raul

On Monday, December 11, 2017, Jimmy Gauvin <[email protected]> wrote:

> Hi,
>
> I used axial coordinates from https://www.redblobgames.com/grids/hexagons/
> to get thru part 1.
> Will do part 2 tonite.
>
>    >./ | +/hxv {~ dbd i. <;._1 ',', dbi
> 675
>
> where :
>
>    dbi=: }: fread 'C:\Downloads\day11inp'
>    dbd=: ;:'n s ne nw se sw'
>    hxv =: 6 2 $ 0 _1 0 1 1 _1 _1 0 1 0 _1 1
>    dbd,.<"1 hxv
> ┌──┬────┐
> │n │0 _1│
> ├──┼────┤
> │s │0 1 │
> ├──┼────┤
> │ne│1 _1│
> ├──┼────┤
> │nw│_1 0│
> ├──┼────┤
> │se│1 0 │
> ├──┼────┤
> │sw│_1 1│
> └──┴────┘
>
>
>   \ n  /
> nw +--+ ne
>   /    \
> -+      +-
>   \    /
> sw +--+ se
>   / s  \
>
>
> On Mon, Dec 11, 2017 at 12:43 PM, Raul Miller <[email protected]>
> wrote:
>
> > I've been struggling with AoC day 11 - either AoC's implementation is
> > wrong, or mine is.
> >
> > Here's my implementation:
> >
> > nms=: ;:'n ne se s sw nw'
> > dir=: ^j.2p1*(%~ i.)#nms
> >
> > delta=: dir {~ nms i. ]
> >
> > location=: +/@delta
> > furthest=: [: ({~ (i. >./)@:|) +/\@delta
> > path=:3 :0
> >   nms {~(|: i."_1 <./)|dir -/ 2-/\(- dir&([ {~ [: (i. >./) +/
> > .*&.+.))^:(0.5 <|)^:a: y
> > )
> > showpath=:3 :0
> >   p=. path y
> >   echo 'steps: ',":#p
> >   echo (":,.#/.~p),.' ',.>~.p
> > )
> >
> > And here's a translation to python along with a request for help:
> >
> > https://www.reddit.com/r/adventofcode/comments/7izym2/
> > 2017_day_11_solutions/dr36ujj/
> >
> > I suppose I might retranslate the python implementation of path back
> > into J, but they both give the same answer, so I'm convinced that
> > that's not the issue.
> >
> > So far, it's only been a few hours, but I've not gotten any real
> > feedback from reddit, and I've gone over this enough times that I'm
> > convinced that if I screwed up I've got such a big blind spot that I'm
> > not going to see through the problem today.
> >
> > Anyways... if anyone else has some insight here (and/or a better
> > implementation), I'd love to see it.
> >
> > Thanks,
> >
> > --
> > Raul
> > ----------------------------------------------------------------------
> > 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

Reply via email to