Sure... you can post this (and future implementations) to the wiki.

Implementation:

move=: _1j_1 >.&.+. 1j1 <.&.+. +
U=: _1j0  move]
L=:  0j_1 move]
R=:  0j1  move]
D=:  1j0  move]

eval2=: 3 :0
  }.|.1 + 3 #. 1 + +.".,/\.1j1&#"1|.|."1>'0 ',y
)

Example:

   eval2 ];._2]0 :0
ULL
RRDDD
LURDL
UUUUD
)
1 9 8 5

I haven't looked at part 2 of part 2 yet (not sure why part 2 has two
parts, but whatever...), but I've got another errand I should have
finished already, so that will have to wait.

-- 
Raul


On Fri, Dec 2, 2016 at 12:14 PM, Joe Bogner <joebog...@gmail.com> wrote:
> Wow, that's compact :)
>
> Can I post it to the wiki?
>
> A few process questions for everyone:
>
> 1. If you post your solution here and would like to have it on the
> wiki, I or someone else can do it. Please just indicate that it can be
> posted. You can just have a blanket statement like "this and future
> solutions can be posted to the wiki"
>
> 2. What do you think of measuring the clock time for coming up with
> the solution? I think it would be a useful data point for others to
> learn how quickly solutions can be solved in J. I'll go back and
> update the wiki with my times (rough times since I didn't time it).
>
> Thanks,
> Joe
>
> On Fri, Dec 2, 2016 at 11:27 AM, Xiao-Yong Jin <jinxiaoy...@gmail.com> wrote:
>> Two long trains from me:
>>
>>    NB.Beware of line break.
>>    ti=:<;._2[0 :0
>> ULL
>> RRDDD
>> LURDL
>> UUUUD
>> )
>>    p2=:'123456789'{~(,|:|."1 j./~i:1)i.[:|.[:>[:}:[:([:([:j./ _1>.1<. [:+. 
>> +)/ [:|.,~)&.>/\.[:|.0;(0j1 0j_1 _1 1{~'UDLR'&i.)&.>
>>    p2p=:'123456789ABCD'{~(0j2 _1j1 0j1 1j1 _2 _1 0 1 2 _1j_1 0j_1 1j_1 
>> 0j_2)i.[:|.[:>[:}:[:([: +`]@.(2<[:+/[:|[:+.+)/ [:|.,~)&.>/\.[:|._2;(0j1 0j_1 
>> _1 1{~'UDLR'&i.)&.>
>>
>>
>>> On Dec 2, 2016, at 9:23 AM, Joe Bogner <joebog...@gmail.com> wrote:
>>>
>>> I posted my solution to part 1 of Day 2
>>>
>>> http://code.jsoftware.com/wiki/Essays/Advent_Of_Code_2016#Solution
>>>
>>> Glad to see others posting their Day 1 (Ric, Henry, Pascal)
>>> ----------------------------------------------------------------------
>>> 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to