Here's another option:

   S=: 13 :'''+.''{~([:+./*.)"1/~#:i.y' 
   S
'+.' {~ [: ([: +./ *.)"1/~ [: #: i.

  S 8
++++++++
+.+.+.+.
++..++..
+...+...
++++....
+.+.....
++......
+.......

Linda









-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Roger Hui
Sent: Saturday, November 05, 2011 2:10 PM
To: Programming forum
Subject: Re: [Jprogramming] Binary Addresses Method

I believe the "and" in your pseudocode maps to 17 b. (bitwise and).  Thus:
   0 = 17 b./~ i.256

For example, using the boolean matrix result to index into '.*',

   '.*' {~ 0 = 17 b./~ i.16
****************
*.*.*.*.*.*.*.*.
**..**..**..**..
*...*...*...*...
****....****....
*.*.....*.*.....
**......**......
*.......*.......
********........
*.*.*.*.........
**..**..........
*...*...........
****............
*.*.............
**..............
*...............



On Sat, Nov 5, 2011 at 10:50 AM, mikel paternain
<[email protected]>wrote:

>
>
>
> In the amazing book Chaos and Fractals New frontiers of Science, the
> authors described a simple algorithm for making the Sierpinski Gasket.
This
> is perhaps the most short and efficient algorithm (in non tacit
programming
> languages) for computing this fractal.
> The basic algorithm is(in pseudocode):
>
> Define x,y
> For y=0 to 255
>     For x=0 to 255
>           If /x And y)=0 Then Pset(x,y) //Pset is a function for drawing
> the point x,y
>     Next x
> Next y
> End
>
> With my little experience inJ the question is how translate this code to J
> . Help me please!
> Thanks in advance!!
>
> Mikel
> ----------------------------------------------------------------------
> 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

Reply via email to