This?
dss=:-:<:3 #.inv 15 21 19 11 5 7
nms=: ;:'n ne se s sw nw'
a11=:3 :0
({:,>./)+/||:+/\dss{~nms i.y
)
a11 10 6 1 1 #;:'se ne s sw'
15 16
Thanks,
--
Raul
On Wed, Dec 13, 2017 at 4:22 PM, Jimmy Gauvin <[email protected]> wrote:
> HI,
>
> I have been thinking about Brian's "cancellation" approach and maybe we can
> sort of formalize it.
>
> Associative relations for cancelling paths:
>
> 0 = N + S = S + N
> 0 = NE + SW = SW + NE
> 0 = NW + SE = SE + NW
>
> Associative relations for simplifying paths:
>
> N = NE + NW = NW + NE
> S = SE + SW = SE + SW
> NE = N + SE = SE + N
> NW = N + SW = SW + N
> SE = S + NE = NE + S
> SW = S + NW = NW + S
>
> Please note that destinations are equivalent but the paths are different.
>
> Now we can do symbolic algebraic simplification.
>
> For example :
>
> ┌──┬──┬─┬──┬──┬──┬──┬─┬──┬──┐
> │SE│NE│N│NW│NW│NE│NE│S│SW│SW│
> └──┴──┴─┴──┴──┴──┴──┴─┴──┴──┘
>
> N = NW + NE and SE = NE + S
> ┌──┬──┬─┬──┬──┬──┬──┬─┬──┬──┐
> │SE│NE│N│NW│N │ │SE│ │SW│SW│
> └──┴──┴─┴──┴──┴──┴──┴─┴──┴──┘
>
> S = SE + SW
> ┌──┬──┬─┬──┬──┬──┬──┬─┬──┬──┐
> │SE│NE│N│NW│N │ │S │ │ │SW│
> └──┴──┴─┴──┴──┴──┴──┴─┴──┴──┘
>
> 0 = N + S
> ┌──┬──┬─┬──┬──┬──┬──┬─┬──┬──┐
> │SE│NE│N│NW│ │ │ │ │ │SW│
> └──┴──┴─┴──┴──┴──┴──┴─┴──┴──┘
>
> 0 = SE + NW
> ┌──┬──┬─┬──┬──┬──┬──┬─┬──┬──┐
> │ │NE│N│ │ │ │ │ │ │SW│
> └──┴──┴─┴──┴──┴──┴──┴─┴──┴──┘
>
> 0 = NE + SW
> ┌──┬──┬─┬──┬──┬──┬──┬─┬──┬──┐
> │ │ │N│ │ │ │ │ │ │ │
> └──┴──┴─┴──┴──┴──┴──┴─┴──┴──┘
>
> The count of remaining symbols is the distance in number of steps.
>
> Programming this is left as an exercise to the reader.
>
>
> On Tue, Dec 12, 2017 at 3:08 PM, Brian Schott <[email protected]>
> wrote:
>
>> No. That's not right. I need to repair my approach.
>>
>> On Tue, Dec 12, 2017 at 2:04 PM, Brian Schott <[email protected]>
>> wrote:
>>
>> > Another way to approach this problem first part, which was refined by
>> > Jimmy's
>> > elegant solution, follows.
>> >
>> >
>> >
>> ----------------------------------------------------------------------
>> 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