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