#!perl -w # # Sierpinski v1.0.5 # by Kevin Reid # # Draws the Sierpinski triangle. # # This program may be freely distributed, and you may # use code from it, as long as my name stays on it. # # Revision history # # 1.0.5 # * Code shortened even more. # * Redraws sped up slightly. # 1.0 # * First release. use Mac'Windows;use constant B=>new RGBColor(0,0,0);END{$w->dispose if$w}($w= new MacWindow new Rect(50,50,314,314),'Sierpinski',1,22,1)->sethook(redraw=>sub {for($x=0;$x<256;$x++){for($y=0;$y<256-$x;$y++){Mac'QuickDraw'SetCPixel$x+$y/2+ 4,256-$y+2,B if!($x&$y)}}});Mac'Events'WaitNextEvent while$w->window;