World zzz338

Classes: DemoLiveLife DemoLiveMand DemoLivePaint DrawRect RedPlane trek WebApp

Methods: draw handle:query: lifestep prototype wmid

Classes

DemoLiveLife

lifestep
dx,dy= me delX, me delY. dx2,dy2= dx idiv: 2, dy idiv: 2. rx,ry= dx2 - 1, dy2 - 1. nextState = FOR(x: me numX)MAP( FOR(y: me numY)MAP( nei = 0. FOR(i: 3)DO( i = i - 1 + x. FOR(j: 3)DO( j = j - 1 + y. nei = nei + ((state at: i) at: j). ]. ]. "Notice cell x,y can count as a nei." IF((state at: x) at: y) THEN( OR(nei == 3; nei == 5;) ) ELSE( nei == 3 ). ]. ]. "Update state, unless embargo is in place." IF{embargo < Sys secs}THEN{state = nextState}. FOR(x: me numX)DO{ FOR(y: me numY)DO{ IF{(state at: x) at: y} THEN{ xx = x * dx + dx2. yy = y * dy + dy2. me green rect: (xx - rx, yy - ry) to: (xx + rx, yy + ry). } ELSE{ xx = x * dx + dx2. yy = y * dy + dy2. me black rect: (xx - rx, yy - ry) to: (xx + rx, yy + ry). } } }.

DemoLiveMand < DemoLivePaint

draw
me clear: 212. FOR(i:70) DO( FOR(j:40) DO( me newink: i*j $ text: 'x' str sw: (i*20, j*20). me newink: i*j $ circ: (i*20, j*20) r: i . me post. )).

DemoLivePaint

draw
me clear: 212. "323." FOR(i:50) DO( FOR(j:30) DO( me newink: i*j $ text: (i*10+j) str sw: (i*20, j*20). me post. )).

DrawRect

handle:query:
v = Vec new. FOR(x : 50) DO( FOR(y : 50) DO( v append: VEC('rect', 20 * x + 40*x sin, 30 * y + 60*y sin, 10, 10, 2, 'green'). v append: VEC('line', 40 * x + 80*x sin, 30 * y + 60*y sin, 555, 555, 2, 'green'). ). ). DICT( 'type', 'draw'; 'title', 'Drawing 100 Rectangles'; 'value', v; 'width', 300; 'height', 500; ).

RedPlane

prototype
Group new vec: VEC( "Fusalage along the X axis" Cube new $ scale: 1 @ 0.2 @ 0.2 $ color: 1 @ 0 @ 0 @ 1, "Wings along the Y axis" Cube new $ scale: 0.3 @ 0.9 @ 0.1 $ color: 0 @ 1 @1 @ 1 $ pos: 0.2 @ 0 @ 0.1, ).

trek < WebApp

wmid
n,k= 175,250. v= for( n) map(0). for( k) do( v at: (Num rand: n) put: 1 ). for(i:x: v) do(n= n - x). (64 ,) imp ; ' :-) '; n; ' :-) '; str meths dir join; ' :-) '; ((-1,-4,-7) unit abs ,) join:'@ ';

WebApp

Method CrossReference

draw
DemoLiveMand   DemoLivePaint  
handle:query:
DrawRect  
lifestep
DemoLiveLife  
prototype
RedPlane  
wmid
trek