East=North corner is Santa's home. ( a little dyslexia here) Sorry.

Linda 

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda A
Alvord
Sent: Saturday, January 2, 2016 8:55 PM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] adventofcode day 3

Here's a visual image of Santa delivering packages. A plot shows his flight
plan. However, this year he delivered maore than one package to the same
child. He is working to correct this before next year. How could he deliver
N packages to N children. So eliminate any   visit to a child for the second
time and add a new child instead. Provide a corrected flight plan.

 

Santa begins from the first point in S, delivers packages and then returns
to his home in the west-North corner of the plot.

 

(from Dave Lambert's original idea, modified for elementary school so that
points are named from 0 to the left and the 0 and up (x,y) coordinates.

 

load 'viewmat plot'

]N=:8

GRB=:|.255*1 0 2{"1 #:i.8

shift=: -"1 <./

grid=: 13 :'(1++"1 >./y)$0'

draw=: ([:i.[:#[)`([:;/[)`]}

flight=: 13 :'viewmat (shift y) draw grid y'

ran=: 13 :'0 0,(-<:y)+?(y,2)$y'

]R=:ran N

]S=:shift R

]T=:|.|:(S draw grid) S

GRB viewmat i.1+N

GRB viewmat T

path=: 13 :'plot ;/|:([y),{.y'

path S

S

 

Linda

 

-----Original Message-----
From: programming-boun...@forums.jsoftware.com
[mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda A
Alvord
Sent: Thursday, December 24, 2015 2:39 AM
To: programm...@jsoftware.com
Subject: Re: [Jprogramming] adventofcode day 3

 

This helped me understand what flight is doing a little better.

 

viewmat i.6

flight Q=:0 0,_4+?5 2$5

shift Q

 

Linda

-----Original Message-----

From:  <mailto:programming-boun...@forums.jsoftware.com>
programming-boun...@forums.jsoftware.com

[ <mailto:programming-boun...@forums.jsoftware.com>
mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Linda A Alvord

Sent: Wednesday, December 23, 2015 10:35 AM

To:  <mailto:programm...@jsoftware.com> programm...@jsoftware.com

Subject: Re: [Jprogramming] adventofcode day 3

 

Dave, I enjoyed your flight so much I never got to day 4! I removed at's and
atop's and then made a series of images. Now can you design the flight lines
that join the successive points to show the flight pattern with dots
connected?

 

load 'viewmat'

shift=: -"1 <./

grid2=: 0 $~ >:@:(>./)

grid=: 13 :'0$~ 1+>./y'

draw=: ([:i.[:#[)`([:;/[)`]}

flight=: 13 :'viewmat (draw grid) shift y'

flight P 

 

A=:#:i.4

viewmat i.4

flight A

B=:3 3#:i.9

viewmat i.9

flight B

viewmat i.16

C=:4 4#:i.16

flight C

viewmat i.29

flight A,(4*B),16*C

A;B;C

shift

grid

draw

flight

 

Linda

 

-----Original Message-----

From:  <mailto:programming-boun...@forums.jsoftware.com>
programming-boun...@forums.jsoftware.com

[ <mailto: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

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=: ( <mailto:i.@#@[)`(;/@:[)`> i.@#@[)`(;/@:[)`]}

 

load'viewmat'

flight =: viewmat @: (draw grid) @: shift

 

flight P

 

----------------------------------------------------------------------

For information about J forums see  <http://www.jsoftware.com/forums.htm>
http://www.jsoftware.com/forums.htm

 

----------------------------------------------------------------------

For information about J forums see  <http://www.jsoftware.com/forums.htm>
http://www.jsoftware.com/forums.htm

 

----------------------------------------------------------------------

For information about J forums see  <http://www.jsoftware.com/forums.htm>
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