%! % From hobbit@pyrite.rutgers.edu Thu Dec 1 21:39:54 1988 % Date: Thu, 1 Dec 1988 3:49:17 EST % From: *Hobbit* % Subject: Yow!! It's *snowing*! %%% bisymmetric snowflake attempts, v2.1 and this time we're going to get it %%% right and mail it out this year. %%% Enters with a number for "srand", or defaults it to something dumb % prelude with srand arg if you want it count 0 ne {srand} if % allow for lossage if empty stack % Stub of pause if not in NeWS systemdict /pause known not { /pause {} def } if %% Randomize "draw" routine for this one: Special one for the walls -- %% reverse video, rnd grayscale [within reason] /whichdraw [ {scribble} {fscribble} {rorsch} ] def %% Setgray turns out to be sort of a luse, at least for the black sheets. /draw {1 setgray whichdraw 0 3 Rnd get exec} def /points 200 array def % storage... /Rnd { % arg1 arg2 Rnd -> abs-val int between arg1 and arg2 2 copy sub abs rand 2 31 exp div mul cvi % between 0 and difference 3 1 roll 2 copy ge {exch} if pop add } def % Rnd % Stuff the generated point in the array and fix the index; syntax is % X Y logpoint, or rescue -> X Y /logpoint { 2 { points idx 3 2 roll put /idx idx 1 add def} repeat } def % Retrieve a point, leaves it on the stack /rescue { 2 { points idx get /idx idx 1 add def } repeat exch } def % Point generation loop should describe one half of one arm. It is mirrored % and duplicated six times around. /rorsch { % funny back-to-back out-and-in thing /Cy 0 def /finalroutine {fill} def % big ugly splotches /width 50 120 Rnd def % *randomize* the width [change here] 0 0 logpoint % start at origin { 5 width Rnd Cy logpoint % stuff it in /Cy Cy 2 40 Rnd add def % Cy increment; change limits here Cy 250 ge { exit} if } loop % diameter limit: change here } def % rorsch % different one, random lines until the cows come home /scribble { 4 setlinewidth 15 25 Rnd { 0 100 Rnd 0 250 Rnd logpoint } repeat /Cy 0 250 Rnd def } def % /scribble % scribble but then inter-fill some of the spaces /fscribble { scribble /finalroutine {eofill} def} def /flake { /idx 1 def % array pointer [from 1, not 0, wtf] /finalroutine {stroke} def % defaults to stroke; can be fill or... %%% Select and perform array-generation algorithm above or as a prelude.. draw % Print one, mirror it, rotate the mess around, etc, etc ... puke... /imax idx def % final array size, do until here 6 { /idx 1 def newpath pause pause rescue moveto % move to first one imax 2 idiv 2 sub { % arraysize - 2 ... rescue lineto } repeat 0 Cy lineto closepath % mirror image routine. We come here with the so-far current path, and % reconstruct it backwards on the other side of the vertical. {exch neg exch moveto} % move {exch neg exch lineto} % line {curveto} {closepath} pathforall % so do it, select fill or stroke above or in the algorithm, and finish up finalroutine 60 rotate } repeat } def % flake %% Now start the real work erasepage 0 setgray clippath fill % black!! %% Okay, now randomize all that other dreck 10 20 Rnd { % number per page gsave 50 500 Rnd 50 700 Rnd translate % position 5 25 Rnd 100 div dup scale % size [% of 500] 1 60 Rnd rotate % rotation flake grestore % do it! } repeat showpage %% _H*