Thanks, however it was a capital v in B. A=:'^<v>' B=:'<v>^' f=: 13 :'((|.|:|.4|+/~i.4),4|+/~i.4){y' f A v<^> <^>v ^>v< >v<^ ^<v> <v>^ v>^< >^<v B(-:"1) f A 0 0 0 0 0 1 0 0
Linda -----Original Message----- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of bill lam Sent: Tuesday, December 15, 2015 8:55 AM To: Programming forum Subject: Re: [Jprogramming] adventofcode day 3 to see why, try this B="1 f A On Dec 15, 2015 7:57 PM, "Linda Alvord" <lindaalv...@verizon.net> wrote: > Why isn't the result 0 0 0 0 0 1 0 0 ? > > A=:'^<v>' > B=:'<V>^' > f=: 13 :'((|.|:|.4|+/~i.4),4|+/~i.4){y' > f A > v<^> > <^>v > ^>v< > >v<^ > ^<v> > <v>^ > v>^< > >^<v > B-:"1 f A > 0 0 0 0 0 0 0 0 > > Linda > > -----Original Message----- > From: programming-boun...@forums.jsoftware.com > [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of David > Lambert > Sent: Thursday, December 3, 2015 9:40 AM > To: programming <programm...@jsoftware.com> > Subject: [Jprogramming] adventofcode day 3 > > Say P is a rank 2 list of 2D coordinates > 4{.P > 0 0 > 0 1 > 0 2 > _1 2 > > Let's map the flight. > > NB. shift moves origin making minimum coordinates independently 0 NB. use: > shift COORDINATES > shift=: -"1 <./ > > NB. grid generates an array of zeros large enough for only the > positive coords NB. use: grid COORDS > grid=: 0 $~ >:@:(>./) > > NB. COORDS draw GRID NB. color by number > draw=: (i.@#@[)`(;/@:[)`]} > > load'viewmat' > flight =: viewmat @: (draw grid) @: shift > > flight P > > ---------------------------------------------------------------------- > 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