same concept but with 24 clock points,

move24 =: (24 | [ + {:@]) ,~ }:@:] + (24 2$0 6 1 5 2 4 3 3 4 2 5 1 6 0 5 _1 4 
_2 3 _3 2 _4 1 _5 0 _6 _1 _5 _2 _4 _3 _3 _4 _2 _5 _1 _6 0 _5 1 _4 2 _3 3 _2 4 
_1 5) {~ 24 | [ + {:@]

draw2 =: 3 : 'plot ;/ |: 2{."1 (],[move24{:@])boxscan (< ,: 0 0 0),~ |. ;/ 
($~24*#) y'

draw2 1 10 14 10 
draw2 2 8




----- Original Message -----
From: 'Pascal Jasmin' via Programming <[email protected]>
To: Programming forum <[email protected]>
Cc: 
Sent: Friday, April 17, 2015 3:09 PM
Subject: [Jprogramming] an interesting plot toy

can visualize this as a logo robot that moves 3 spaces at a time in the 
direction of a clockface.  It moves like a chess knight for directions that are 
not 12 3 6 9.

boxscan =: ((&.>)/)(>@:) 
move12 =: (12 | [ + {:@]) ,~ }:@:] + (12 2$0 3 1 2 2 1 3 0 2 _1 1 _2 0 _3 _1 _2 
_2 _1 _3 0 _2 1 _1 2) {~ 12 | [ + {:@]

require 'plot'

draw =: 3 : 'plot  ;/ |: 2{."1  (],[move12{:@])boxscan (< ,: 0 0 0),~  |. ;/ 
($~12*#) y'

for non repeating patterns, can change the 12*# to 144*#

the easiest patterns to understand
draw 1
draw 3

some cool patterns


draw 1 4
draw 3 2 6 1 4 11
draw 1 3 4 3 11
draw 1 5 10 4 2
----------------------------------------------------------------------
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