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

Reply via email to