Heh, I value sleep more than getting my name on the leaderboard... plus I was stumped until I read Reddit user Godspiral's solution <https://www.reddit.com/r/adventofcode/comments/3v8roh/day_3_solutions/cxldcnx> .
I did enjoy how part 2 can be solved with just 3 more strategically-placed characters. I really like *]\* as an alternative to dyad *$* (reshape). On Thu, Dec 3, 2015 at 11:36 AM, 'Pascal Jasmin' via Programming < [email protected]> wrote: > Winner solution, (but you didn't submit it at 12:18 :P) > > > using complex encoding for pairs should probably always be done? It makes > your part 2 especially elegant. > > > > > ----- Original Message ----- > From: Alex Shroyer <[email protected]> > To: [email protected] > Sent: Thursday, December 3, 2015 11:25 AM > Subject: Re: [Jprogramming] advent of code - day 3 > > I was stuck at '^v<>'i.s , but came up with these after I peeked at someone > else's solution: > > part1=:#~.,+/\0,0j1 0j_1 _1 1{~'^v<>'i.s > part2=:#~.,+/\0,0j1 0j_1 _1 1{~'^v<>'i._2]\s > > On Thu, Dec 3, 2015 at 8:59 AM, Joe Bogner <[email protected]> wrote: > > > Mine: > > > > data=:fread 'advent2015/day3.txt' > > getMoves=: ((0,1),(0,_1),(1,0),:(_1,0)) {~ ('^v><' i. ]) > > addStart =: (1 2 $ 0) , ] > > smoutput answer1 =: # ~. +/\ addStart @: getMoves data > > smoutput answer2 =: # ~. _2[\ ; +/\"2 (((0,1) $~ #) addStart@,./. > > getMoves) data > > > > > > > > > > On Thu, Dec 3, 2015 at 7:00 AM, Ryan Eckbo <[email protected]> wrote: > > > Data=. }: freads'/tmp/input.txt' > > > houses=: 3 : '+/\ (0 0), (4 2$0 1 1 0 0 _1 _1 0){~ ''^>v<'' i. y' > > > > > > # part 1 > > > {. $ ~. houses Data > > > > > > # part 2 > > > santa=. 2 | i. # Data > > > robo=. -. santa > > > {. $ ~. (santa&# ,&shouses robo&#) Data > > > ---------------------------------------------------------------------- > > > 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
