IAAA        Artificial       Paul Groot on Artificial, Hypertalk, and the aesthetics of program code   


Artificial
HyperTalk Code.


(Fragment of the program code of Artificial.Mac, as recited by Huge Harry during the exhibition Tools & Tales in Artis, 's Hertogenbosch, January 1994.)

[:nw] Script of Hypertalk button, den boss, make & print & delete.
[:nh]
on mouse up,
repeat,
convert the time to date-Items.
put it into t. -- year month day hour minute second day-Of-Week.
if item 7 of t = 1, or item 7 of t = 6, or
item 4 of t smaller than 9, or item 4 of t greater than 18, then
answer "Artificial has suspended its performance." & return & return &
"To re-activate Artificial, click on the Restart button"
with "Restart".
ask "For how many more hours should Artificial continue?" with "1".
put it into hours.
if hours greater than 0, then
put the seconds into start.
repeat while the seconds smaller than start + hours times 3600,
perform.
end repeat.
end if.
end if.
perform.
end repeat.
end mouse up.

on perform,
send mouse up to button "make one new picture".
wait 10 seconds.
-- open printing with dialog.
print this card.
-- do Menu "print card".
-- close printing.
do Menu "delete card".
go "art".
end perform.
[:nw] script of hypertalk button, make one new picture.
[:nh]
on mouse up,
global x max, y max.
init.
go output.
do Menu "new card".
do r word plaatjes-grid R texture-grid R && 0, 0, x max, y max.
if r 6 = 1, then
repeat 3,
background R 0, 0, x max, y max.
end repeat.
else,
distribution.
end if.
choose browse tool.
end mouse up.
- - - - - - - - - -


on distribution,
global area seq, transformations, x max, y max.

put number of words in area seq into n.
if r 6 = 1, then background R 0, 0, x max, y max.
if r 6 = 1, then invert R 0, 0, x max, y max.
repeat with i = 1 to n,
put word i of area seq into area.
do "init seqs" && area.
distrObject.
dor word transformations.
end repeat.
end distribution.
- - - - - - - - - -
- - - - - - - - - -

on init seqs x mi, y mi, x ma, y ma.
global angle seq, arrayddu, arrayddv, arraydu, arraydv, brushpattern seq, Â
brushpatterns, brush seq, distributee, distributees, distrmethod, d x pos, d y pos, Â
do seq, edgeon, edgeons, effects, Â
fillpatterns, fillpattern seq, firstinit seqs, flip seq, grainon, grainons, invert seq, Â
klonestacks, klonestack, Â
localcenters, lighten seq, linesizes, linesize seq, multiplemode, Â
objectset, objectTypes, polyangles, polyNs, polyN seq, posmode, repeatmode, repeatmodes, Â
rotate seq, sizemode, sizemodes, usedbrushes, Â
x max, y max, x margin, y margin, x left, x right, y up, y down, x seq, y seq, x size, y size, x size seq,
ysize seq.

put "kloning" into distrmethod. -- moet later wel gevarieerd worden.


put x mi into x left.
put x ma into x right.
put y mi into y up.
put y ma into y down.

put "0" & return & rsub seq usedbrushes into brush seq.
put "0" & return & rsub seq linesizes into linesize seq.
put "0" & return & rsub seq polyNs into polyN seq.
put rsub seq objectTypes into objectset.
put "0" & return & rsub seq polyangles into angle seq.
put "0" & return & rsub seq fillpatterns into fillpattern seq.
put "0" & return & rsub seq brushpatterns into brushpattern seq.

put "0" & return & "null " into flip seq.
if r 2 = 1, then put rsubset "null horizontal vertical" Â
&& rsubset "null horizontal vertical", after line 2 of flip seq.

put "0" & return & "null " into rotate seq.
if r 2 = 1, then put rsubset "null right left" Â
&& rsubset "null right left", after line 2 of rotate seq.
put "0" & return & "false " into invert seq.
if effects = "yes", then Â
put rsubset "true false false false" after line 2 of invert seq.


put "0" & return & "true" && Â
rsub seq "true true false true false" into do seq.

if r 6 = 1, then
put "0" & return & Â
sym rsub seq "0 0 0 0 0 0 0 0 0 2 4 6 8 10 12", into lighten seq.
else,
put "0" & return & "0" into lighten seq.
end if.


putr word repeatmodes into repeatmode.
putr word grainons into grainon.
end init seqs.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

on clockpulse,
global brush seq, do seq, linesize seq, polyN seq, angle seq, fillpattern seq,
flip seq, brushpattern seq, Â
bucketpattern seq, backgroundpattern seq, invert seq, lighten seq, Â
darken seq, rotate seq, x seq, y seq, x size seq, y size seq.

add 1, to word 1 of line 1 of brush seq.
add 1, to word 1 of line 1 of do seq.
add 1, to word 1 of line 1 of linesize seq.
add 1, to word 1 of line 1 of polyN seq.
add 1, to word 1 of line 1 of angle seq.
add 1, to word 1 of line 1 of fillpattern seq.
add 1, to word 1 of line 1 of flip seq.
add 1, to word 1 of line 1 of brushpattern seq.
-- add 1, to word 1 of line 1 of bucketpattern seq.
-- add 1, to word 1 of line 1 of backgroundpattern seq.
add 1, to word 1 of line 1 of invert seq.
add 1, to word 1 of line 1 of lighten seq.
-- add 1, to word 1 of line 1 of darken seq.
add 1, to word 1 of line 1 of rotate seq.
-- add 1, to word 1 of line 1 of x seq.
-- add 1, to word 1 of line 1 of y seq.
-- add 1, to word 1 of line 1 of x size seq.
-- add 1, to word 1 of line 1 of y size seq.
end clockpulse.
- - - - - - - - - - - - - - - - - - - - - - - - - - - -

on maakElement x ell, y ell, lx, ly,
global brush seq, linesize seq, polyN seq, angle seq, fillpattern seq, brushpattern seq, Â
distributee, localtrafos, x max, y max.

set brush to current brush seq.
set linesize to current linesize seq.
set polysides to current polyN seq.
-- put current fillpattern seq into fillpattern.
-- put current brushpattern seq into brushpattern.
-- put current angle seq into polyangle.

do distributee && "0, 0, lx, ly".
dor word localtrafos && "0, 0, lx, ly".
end maakElement.
- - - - - - - - - - - - - - - - - - - - - - -- minus

on klontinue x 1, y 1, x s, y s,
global do seq, flip seq, invert seq, lighten seq, rotate seq, x max, y max, ol d x size, ol d y size.

if current do seq = "false", then exit klontinue.
if min x 1, y 1 smaller than 0 or max x 1 + x s, x 1 + ol d x size greater than x max,
or max y 1 + y s, y 1 + ol d y size greater than y max, Â
then exit klontinue.
do Menu "paste picture".
drag from 2, 2 to x 1 + 2, y 1 + 2.
-- if ol d x size is not x s, or ol d y size is not y s, then Â
-- drag from x 1 + ol d x size, y 1 + ol d y size, to x 1 + x s, y 1 + y s with command Key.
do Menu "select".
if current flip seq is not null, then do Menu "flip" && current flip seq.
if current rotate seq is not null, then do Menu "rotate" && current rotate seq.
repeat current lighten seq.
do Menu "lighten".
end repeat.
if current, invert seq, then do Menu "invert".
end klontinue.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

on distrObject,
global basics, brush seq, colorstatus, distributee, distributees, distributionModes, Â
distrObjectMode, edgeon, Â
edgeons, effects1, effects2, linesize seq, separation, symmetries, x max, y max.

push card.
go card 2 of aux.
clear R 0, 0, x max, y max.
put "false" into edgeUsed.
put "false" into spikkelUsed.
put "3" into line 2 of linesize seq.
put "4" into line 2 of brush seq.
put x max div r 10 + 3 into x ell.
putr word x ell && y max div r 10 + 3 into y ell.

putr word distributees into distributee.
-- if distributee = "openR", then
-- put "no" into edgeon.
-- else,
-- putr word edgeons into edgeon.
-- end if,

putr word distributionModes into distributionMode.
do distributionMode && "xell, y ell, x max, y max".

putr word x max && x max && x max && rr 150, x max, into x l.
put y max into y l,
putr word 0 && x max minus x l, into x 1.
put 0 into y 1.
if x max = x l, or x 1 = x max minus x l, then
put 1 into x 1source.
else,
put x max minus x l + 1 into x 1source.
end if.
if y max = y l, or y 1 = y max minus y l, then
put 1 into y 1source.
else,
put y max minus y l + 1 into y 1source.
end if.
click R x 1source + 1, y 1source + 1.

choose select tool.
if symmetries and r 2 = 1, then
do Menu "select all".
do Menu "copy picture".
do Menu "paste picture".
do Menu "rotate" &&r word "right left".
do Menu "select".
end if.
if symmetries and r 2 = 1, then
do Menu "select all".
do Menu "copy picture".
do Menu "paste picture".
do Menu "flip" &&r word "vertical horizontal".
do Menu "select".
end if.

do Menu "select all".
if r 6 = 1, then do Menu "flip horizontal".
if r 6 = 1, then do Menu "flip vertical".
dor word effects1 && "1, 1, x max minus 1, y max minus 1".
dor word effects2 && "1, 1, x max minus 1, y max minus 1".
click R x 1source + 1, y 1source + 1.
select R x 1source, y 1source, x 1source + x l minus 2, y 1source + y l minus 2.
do Menu "select".
do Menu "copy picture".
pop card.
do Menu "paste picture".
if x 1 + 1 is not x 1source, or y 1 + 1 is not y 1source, Â
then drag from x 1source + 1, y 1source, to x 1 + 2, y 1 + 2.
if distributionMode is in "partitionR R symR", and distributee = "openR", or Â
distributee is in "multiple R inside R fill R superR", and "openR" is in basics, and r 2 = 1, Â
then
do Menu "transparent".
else, if r 2 = 1, and not "lightenR" is in effects2, or "fragmentR" is in effects1,
then -- separate.
do Menu "trace edges".
do Menu "invert".
do Menu "paste picture".
if x 1 + 2 is not x 1source, or y 1 + 2 is not y 1source, Â
then drag from x 1source + 1, y 1source + 1 to x 1 + 3, y 1 + 3.
end if.
end distrObject
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --

on auxElement x ell, y ell, lx, ly,
global ol d x size, ol d y size, x max, y max.

maakElement 0, 0, lx, ly.
if lx smaller than x max, then clear R lx, 0, x max, y max.
if ly smaller than y max, then clear R 0, ly, x max, y max.
select R 0, 0, lx, ly.
do Menu "cut picture".
put lx into ol d x size.
put ly into ol d y size.
end auxElement.
- - - - - - - - - - - - - - - - - - - - - - -- minus

on auxhor x ell, y ell, x l, y l,
global auxtrafos, old d y, ol d x size, ol d y size, x max, y max.

putr word x ell && x ell div 2 + random x ell into d x pos.
put x l minus x ell / d x pos into n.
put round y l minus y ell / n into d y pos.

auxElement 0, 0, x ell, y ell.
put 0 into x pos.
put 0 into y pos.
repeat,
klontinue x pos, y pos, x ell, y ell.
add d x pos to x pos.
add d y pos to y pos.
clockpulse.
if x pos + x ell greater than x l, then exit repeat.
end repeat.
dor word auxtrafos && "0, 0, x l, y l".
if y l smaller than y max, then clear R 0, y l, x max, y max.
select R 0, 0, x l, y l.
do Menu "cut picture".
put x l into ol d x size.
put y l into ol d y size.
put y ell into old d y.
end auxhor. - - - - - - - - - - - - - - - - - - - - -- minus

on auxPlacements x ell, y ell, x l, y l,
global auxtrafos, ol d x size, ol d y size.

auxElement 0, 0, x ell, y ell.
repeat random y l times x l div x ell times y ell + 1.
klontinue random x l minus x ell, random y l minus y ell, x ell, y ell.
clockpulse.
end repeat.
dor word auxtrafos && "0, 0, x l, y l".
select R 0, 0, x l, y l.
do Menu "cut picture".
end auxPlacements.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

on auxVer x ell, y ell, x l, y l,
global auxtrafos, old d x, ol d x size, ol d y size, x max, y max.

putr word y ell && y ell div 2 + random y ell into d y pos.
put y l minus y ell / d y pos into n.
put round x l minus x ell / n into d x pos.
auxElement 0, 0, x ell, y ell.
put 0 into x pos.
put 0 into y pos.
repeat,
klontinue x pos, y pos, x ell, y ell.
add d x pos to x pos.
add d y pos to y pos.
clockpulse.
if y pos + y ell greater than y l, then exit repeat.
end repeat.
dor word auxtrafos && "0, 0, x l, y l".
clear R x l, 0, x max, y max.
select R 0, 0, x l, y l.
do Menu "cut picture".
put x l into ol d x size.
put y l into ol d y size.
put x ell into old d x.
end auxVer.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
on horRep x ell, y ell, x l, y l.
global old d x, ol d x size, ol d y size, x max, y max.

put x ell into old d x.
putr word y l && y l && y l minus random y l div 2 into y length.
putr word x ell && x ell && max x ell, random x l div 3 into x length.
dor word "auxVer auxPlacements" && "xell, y ell, x length, y length".

putr word x ell && old d x && old d x div 2 + random old d x into d x pos.
put x l minus x ell / d x pos into n.
put round y l minus y length / n into d y pos.
put x length into ol d x size.
put y length into ol d y size.
put 0 into x pos.
put 0 into y pos.
init seqs 0, 0, x l, y l.
repeat,
klontinue x pos, y pos, x length, y length.
add d x pos to x pos.
add d y pos to y pos.
clockpulse.
if x pos greater than x l, then exit repeat.
end repeat.
end horRep.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --

on placements x ell, y ell, x l, y l,
global ol d x pos, ol d y pos, ol d x size, ol d y size.

put max x ell + 20, x l div r 2 + 1 into x length.
put max y ell + 20, y l div r 2 + 1 into y length.
dor word " auxElement auxVer auxHor auxPlacements" && "xell, y ell, x length, y length".
init seqs 0, 0, x l, y l.
repeat r 4 times y l times x l div x length times y length.
klontinue random x l minus x length, random y l minus y length, x length, y length.
clockpulse.
end repeat.
end placements.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- minus

on verRep x ell, y ell, x l, y l,
global old d y, ol d x size, ol d y size, x max, y max.

put y ell into old d y.
putr word x l && x l && x l minus random x l div 2 into x length.
putr word y ell && y ell && max y ell, random y l div 3 into y length.
dor word "auxHor auxPlacements" && "xell, y ell, x length, y length".

putr word y ell && old d y && old d y div 2 + random old d y into d y pos.
put y l minus y ell / d y pos into n.
put round x l minus x length / n into d x pos.
put x length into ol d x size.
put y length into ol d y size.
put 0 into x pos.
put 0 into y pos.
init seqs 0, 0, x l, y l.
repeat,
klontinue x pos, y pos, x length, y length.
add d x pos to x pos.
add d y pos to y pos.
clockpulse.
if y pos greater than y l, then exit repeat.
end repeat.
end verRep.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

function current x.
put word 1 of line 1 of x mod number of words in line 2 of x into i.
return word i + 1 of line 2 of x.
end current.
- - - - - - - - - - --
function rsub seq x.
put random number of words in x into n.
put random number of words in x minus n + 1 into i.
put empty into ss.
repeat with j = i to i + n minus 1.
put space & word j of x & space after ss.
end repeat.
return ss.
end rsub seq.
- - - - - - - - - - - - --

function sym x.
put x into ss.
put number of words in x into n.
repeat with j = 1 to n minus 1,
put space & word n minus j of x & space after ss.
end repeat.
return ss.
end sym.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --

on all R e, x 1, y 1, x 2, y 2,
do e && x 1 &", "& y 1 &", "& x 2 &", "& y 2.
end allR.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --

on background R x 1, y 1, x 2, y 2,
bucket R r 39 + 1, x 1, y 1, x 2, y 2. -- r word "2 21 31 32 ".
repeat 2,
if r 2 = 1, then zoomAll.
if r 2 = 1, then lighten R x 1, y 1, x 2, y 2.
if r 2 = 1, then bucket R r 39 + 1, x 1, y 1, x 2, y 2 -- r word "3 4 5 6 11 13 14 15 16 17 18 19 22".
if r 2 = 1, then scatterKlone R x 1, y 1, x 2, y 2.
if r 2 = 1, then dor word "thicken R verstippelR" && " x 1, y 1, x 2, y 2".
if r 2 = 1, then edge R x 1, y 1, x 2, y 2.
end repeat.
end backgroundR.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --

on click R x, y,
choose brush tool.
set brush to 28.
set pattern to 12.
click at x, y.
end clickR.
- - - - - - - - - - - - - - minus

on clear R x 1, y 1, x 2, y 2,
choose select tool.
drag from x 1, y 1 to x 2, y 2.
do Menu "clear picture".
end clearR.
- - - - - - - - - - - - - - - -

on do area e, x 1, y 1, x 2, y 2,
global dHC, x max, y max.
if inside x 1, y 1, x 2, y 2, x max, y max = "yes", then
add 1 to dHC.
if dHC greater than number of words in e, then put 1 into dHC.
do word dHC of e && x 1 &", "& y 1 &", "& x 2 &", "& y 2.
end if.
end do area.
- - - - - - - - - - - - - - - - - - - - - - - - minus

on doeCenter e, x, y, d x, d y,
global dHC, x max, y max.
if inside x minus d x, y minus d y, x + d x, y + d y, x max, y max = "yes", then
add 1 to dHC.
if dHC greater than number of words in e then put 1 into dHC.
put word dHC of e into c.
do c && x minus d x &", "& y minus d y &", "& x + d x &", "& y + d y.
end if.
end doeCenter.
- - - - - - - - - - - - - - - - - - - - minus

on edgethicken R x 1, y 1, x 2, y 2,
edge R x 1 + 1, y 1 + 1, x 2 minus 1, y 2 minus 1.
thicken R x 1, y 1, x 2, y 2.
end edgethickenR.
- - - - - - - - - - - - - - - - - - - - minus

on filled R x 1, y 1, x 2, y 2,
global objectset, linesizes, noisefill, spikkelmode, x max, y max.
if min abs x 1 minus x 2, abs y 2 minus y 1 greater than 10 and inside x 1, y 1, x 2, y 2, x max, y max = "yes", then
put the linesize into store.
set the linesize to 1.
set the filled to true.
do area objectset, x 1, y 1, x 2, y 2.
if noisefill = "yes", then spikkels.
set the linesize to store.
end if.
end filledR.
- - - - - - - - - - - - - - - - - - - - - - - - - - -- minus

on fill R x1, y1, x2, y2,
global fillers, used brushes, brush-patterns, klone-mode, klone-modes, first-klone.

put "true" into first-klone.
putr word klone-modes into klone-mode.

set brush to r word used-brushes.
set pattern to r word brush-patterns.
put r word fillers into filler.
put min abs x1 minus x2, abs y2 minus y1 into breedte.
put y1 into b y.
put y2 into e y.
put x1 into b x.
put x2 into e x.
put r word breedte && r2 times breedte + 10 into delta.
repeat while b x smaller than e x and b y smaller than e y,
do filler && b x, b y, b x + breedte, b y + breedte.
if breedte = abs x 1 minus x 2, then
put b y + delta into b y.
else,
put b x + delta into b x.
end if.
end repeat.
end fill R.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*********************************************************

on fragment R x1, y1, x2, y2,
global fragment-effects, x max, y max.

do r word fragment-effects && x1, y1, x2, y2.
shade-light R x1, y1, x2, y2.
set the pattern to 12.
choose bucket tool.
click at 1, 1.
click at 1, y max minus 1.
click at x max minus 1, 1.
click at x max minus 1, y max minus 1.
click at r x max, r y max.
edge R x1, y1, x2, y2.
end fragment R.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

on geo x1, y1, x2, y2,
global local-centers, x max, y max, x 0, y 0.

put "fill R filled R grain R invert R lightedge R line R multiple R" into geos.
put "oval R polyin R rectangle R roundRect R superR" after geos.

dor word geos && "x1, y1, x2, y2".

put x1 & , & y1 & , & x1 minus 7 & , & y1 minus 7 & , & x2 + 7 & , & y2
+ 7 into local-centers.
end geo.
- - - - - - - - - - - -
Ê
on inside R x1, y1, x2, y2,
global x max, y max, multiple mode, multiplee, object set, used brushes,
brush patterns.

set the brush to r word used brushes.
set the pattern to r word brush patterns.
put the linesize into l n s z
multiply l n sz by 4. -- 2 maal 1 lijn + 1 interlinie.
put object set into store.
put r word store into object set.

put x2 minus x1 div 2 into x rad.
put y2 minus y1 div 2 into y rad.
if min x rad, y rad smaller than 10 then exit inside R.
put round average x1, x2 into x point.
put round average y1, y2 into y point.
put minus max l n s z, random x rad div 3 into dx rad.
putr word dx rad && minus max l n s z, random y rad div 3 into dy rad.
putr word 0 && dx rad + random abs 2 times dx rad into dx point.
putr word 0 && dy rad + random abs 2 times dy rad into dy point.

repeat,
if min x rad, y rad smaller than 10 or x point smaller than x1,
then exit repeat.
do multiplee && "x point minus x rad, y point minus y rad, x point +
x rad, y point + y rad".
add dx point to x point.
add dy point to y point.
add dx rad to x rad.
add dy rad to y rad.
end repeat.
put store into object set.
end inside R.
- - - - - - - - - - - -

on light bucket All,
global bucket patterns, color status, x max, y max, x point, y point.
if color status smaller than 1, then, -- niet alleen wit,
shade light R 0, 0, x max, y max.
bucket choice All.
if r2 = 1, then
edge R 0, 0, x max, y max.
end if.
else,
bucket choice All.
put 0 into color status.
end if.
end light bucket All.
- - - - - - - - - -

on light edge All,
global color status, darken status, edge status, x max, y max.
shade light R 0, 0, x max, y max.
edge R 0, 0, x max, y max.
put 1 into color status. -- wit.
put 0 into edge status. -- OK.
put 0 into darken status. -- OK.
end light edge All.
- - - - - - - - - -

on lines R x1, y1, x2, y2,
global irregulars, edge on, edge ons.
putr word edge ons into edge on.
if min abs x1 minus x2, abs y2 minus y1 greater than 10,
then do area irregulars, x1, y1, x2, y2.
end lines R.
- - - - - - - - - -

on multiple R x1, y1, x2, y2,
global x max, y max, multiple mode, multiplee, object set, used brushes, brush patterns.

set the brush to r word used brushes.
set the pattern to r word brush patterns.

put the linesize into l n s z.
multiply l n s z by 4. -- 2 maal 1 lijn + 1 interlinie.
put 0 into dx point.
put 0 into dy point.
put 0 into dx length.
put 0 into dy length.
put 0 into ddx point.
put 0 into ddy point.

put object set into store.
putr word store into object set.
put max 12, random abs x2 minus x1 div 2 into x length. --
2 times 9 smaller than x2 minus x1 minimaal 20.
put max 12, random abs y2 minus y1 div 2 into y length. --
2 times 9 smaller than y2 minus y1.
put round average x1, x2 into x point.
put round average y1, y2 into y point.

if multiple mode contains "x p", then
put max l n s z, x length div 8 + random x length div 4
into dx point.
if multiple mode contains " d x ", then put rsign times random
dx point div 3 into ddx point.
end if.
if multiple mode contains "yp", then
put max l n s z, y length div 8 + random y length div 4
into dy point.
if multiple mode contains dy, then put r sign times random dy point div 3
into ddy point.
end if.
if multiple mode contains "x l", then put minus max l n s z, random x length div 3
into dx length.
if multiple mode contains "y l", then put minus max l n s z, random y length div 3
into dy length.

repeat,
if min x length, y length smaller than 10, or x point smaller than x1,
or x point + x length greater than x 2, Â
or y point smaller than y1, or y point + y length greater than y2,
then exit repeat.
do multiplee && "xpoint minus x length, y point minus y length,
x point + x length, y point + y length".
add d x point to x point.
add d y point to y point.
if multiplemode contains "random", then
put x point minus x length div 2 + random x length into x point.
put y point minus y length div 2 + random y length into y point.
end if.
add dx length to x length.
add d y length to y length.
add d d x point to d x point.
add d d y point to y point.
end repeat.
put store into object set.
-- flip R x1, y1, x2, y2.
end multiple R.
- - - - - - - - -

on nil All,
end nil All.
- - - - - - - -

on open R x1, y1, x2, y2,
global object set, edge on.
set the filled to false.
put "no" into edge on.
if min abs x1 minus x2, abs y2 minus y1 greater than 10,
then do area object set, x1, y1, x2, y2.
end open R.
- - - - - - - - - -

on partition R e, x1, y1, x2, y2,

if r2 = 1, or min x2 minus x1, y2 minus y1 smaller than 300, then
do e && x1 & , & y1 & , & x2 & , & y2.
else
if r2 = 1, then
put x1 + x2 minus x1 div r2 + 1 into x new.
partition R e, x1, y1, x new, y2.
partition R e, x new, y1, x2, y2.
else,
put y1 + y2 minus y1 div r2 + 1 into y new.
partition R e, x1, y1, x2, y new.
partition R e, x1, y new, x2, y2.
end if.
end if.
end partition R.
- - - - - - - - - -


on partition R R x ell, y ell, x l, y l,
global distributees.

putr word distributees into e.
if r 2 = 1, then
put x l div r2 + 1 into x new.
partition R e, 0, 0, x new, y l.
partition R e, x new, 0, x l, y l.
else,
put y l div r2 + 1 into y new.
partition R e, 0, 0, x l, y new.
partition R e, 0, y new, x l, y l.
end if.
end partition R R.
- - - - - - - - -

on pick plaatje x1, y1, x2, y2,
global color status, first klone, g r p l Cats, k l p lC ats, k l x, k l y,
klone card, klone mode, klone stack, local centers, Â
x c, y c, x max, y max.

if min abs x2 minus x1, abs y2 minus y1 greater than 100,
and g r p l cats is not empty, then
put "grote Plaatjes" into klone stack.
put r word g r p l Cats into klone card.
else,
put "kleine Plaatjes" into klone stack.
put r word any line of k l p l Cats into klone card.
end if.
put "true" into first klone.
put "change" into klone mode.

klone ref to x1, y1, x2, y2.
put x c & , & y c & , & x 1 & , & y 1 & , & x2 & , & y2 into local centers.
put x c into k l x.
put y c into k l y.
put 0 into colorstatus.
end pickplaatje.
- - - - - - - - - -


on scatter Klone All,
global x max, y max.
scatter Klone R 0, 0, x max, y max.
end scatter Klone All.
- - - - - - - - - -


on scatter Klone R x1, y1, x2, y2,
global scatter mode, scatter trafos.

put x2 minus x1 into x s.
put y2 minus y1 into y s.

if scatter mode is "move One", then
put 100 + random x s div 2 into l x.
put 100 + random y s div 2 into l y.
put random x s minus l x into x 0.
put random y s minus l y into y 0.
click R x 0 + 1, y 0 + 1.
choose select tool.
drag from x 0, y 0 to x 0 + l x, y 0 + l y.
do Menu "copy picture".
end if.

repeat random 12,
choose select tool.
put 100 + random x s div 2 into l x.
put 100 + random y s div 2 into l y.
put max 0, min x s minus l x, random x s minus l x + 200 minus 100 into x t, -- x target.
put max 0, min y s minus l y, random y s minus l y + 200 minus 100 into y t.
if scatter mode is "move All", then
put random x s minus l x into x 0.
put random y s minus l y into y 0.
drag from x 0, y 0 to x 0 + lx, y 0 + ly.
drag from x 0 + 1, y 0 + 1, to x t + 1, y t + 1, with option Key.
else, if scatter mode is "move One", then
do Menu "paste picture".
drag from x 0 + 1, y 0 + 1, to x t + 1, y t + 1, with option Key.
else,
-- click R x t, y t.
-- choose select tool.
drag from x t, y t to x t + lx, y t + l y.
do Menu "copy picture".
do Menu "paste picture".
end if.
do Menu "select".
if scatter trafos contains "flip", and r2 = 1, Â
then do Menu "flip" && r word "horizontal vertical".
if scattertrafos contains "rotate", and r 2 = 1, Â
then do Menu "rotate" && r word "left right".
if scatter trafos contains "invert", and r2 = 1, Â
then do Menu "invert".
end repeat.
end scatter Klone R.
- - - - - - - - - -

on schilderij x 1, y 1, x 2, y 2, -- n b klone ref to is veranderd!
global local centers, first klone, klx, kly, klone mode, klone stack.

put "textures" into klone stack.
put "true" into first klone.
put "change" into klone mode.

klone-ref-to x1, y1, x2, y2.
rectangle R x1, y1, x2, y2.
put x1 &", " & y1 &", "& x1 minus 7 & , & y1 minus 7 & , & x 2 + 7 & ,
& y2 + 7 into local centers.
put x1 into klx.
put y1 into kly.
end schilderij.
- - - - - - - - -

on select R x1, y1, x2, y2,
choose select tool.
drag from x1, y1 to x2, y2.
end selectR.
- - - - - - - - -

on shade light R x1, y1, x2, y2,
global x point, y point, x max, y max.

put x2 minus x1 div 2 into x rad.
put y2 minus y1 div 2 into y rad.
put round average x1, x2 into x point.
put round average y1, y2 into y point.
if r2 = 1, then
put minus x rad div 15 into d x rad.
putr word 0 && minus random y rad div 15 + 1 into d y rad.
else,
put minus y rad div 15 into d y rad.
putr word 0 && minus random x rad div 15 + 1 into d x rad.
end if.
putr word 0 && d x rad + random abs 2 times d x rad into d x point.
putr word 0 && d y rad + random abs 2 times d y rad into d y point.

repeat,
if min x rad, y rad smaller than 1, then exit repeat.
select R x point minus x rad, y point minus y rad, x point + x rad, y point + y rad.
do Menu "lighten".
add d x point to x point.
add d y point to y point.
add d x rad to x rad.
add d y rad to y rad.
end repeat.
end shade light R.
- - - - - - - - - -
-

on super R x1, y 1, x2, y2.
global superees, used -brushes, brushpatterns, klone-mode, first-klone.

put "true" into firstklone.
put "change" into klonemode.

set the brush to r word used brushes.
set the pattern to r word brush-patterns.

put r word superees into superee.
repeat r 4 + 1,
do superee && "x1, y 1, x 2, y 2".
end repeat.
end superR.
- - - - - - - -

on sym Null All,
global x max, y max.
sym Trafo 0, 0, x max, y max.
end sym Null All.
- - - - - - - -

on sym Trafo x 1, y 1, x 2, y 2.
sym S null R, x 2 minus x 1 div 12, y 2 minus y 1 div 12, x 2 minus x 1, y 2 minus y 1.
end sym Trafo.
- - - - - - - -
on sym R x ell, y ell, sx, sy,
global distributees.
sym S r word distributees, x ell, y ell, sx , s y.
end sym R.
- - - - - - - -

on sym S e, x ell, y ell, s x, s y,
global x max, y max, sym Modes.


put r 5 + 1 into divisor.
put r word sym Modes into mode.

if mode = "hor rep", then
put s x / divisor into d x.
put round d x / 2 into x c.
put s y div 2 into y c.
do e && "0, 0, " & round d x &", "& s y.
choose select tool.
repeat, with n = 1 to divisor minus 1,
drag from 0, 0 to round d x, s y.
drag from x c, y c to round x c + n times d x, y c with Option Key.
if n mod 2 = 1, then do Menu "flip horizontal".
end repeat.
else, if mode = "vertrep", then, -- vertikale verdeling,
put s y / divisor into d y.
put sx div 2 into x c.
put round d y / 2 into y c.
do e && "0, 0, "& s x &", "& round d y.
choose select tool.
repeat, with n = 1 to divisor minus 1,
drag from 0, 0 to s x, round d y.
drag from x c, y c to x c, round y c + n times d y, with Option Key.
if n mod 2 = 1, then do Menu "flip vertical".
end repeat.
end if.
end sym S.
- - - - - - - - - - - - - -

on thicken R x 1, y 1, x 2, y 2,
put r 2 into l l.
put 0 into l n.
put 0 into d x.
put 0 into d y.
select R x 1 + 3, y 1 + 3, x 2, y 2.
do Menu "copy picture".
repeat random 3,
if r 2 = 1, then
put 1 into d x.
else,
put 1 into d y.
end if.
do Menu "paste picture".
drag from x 1 + d x + 20, y 1 + d y + 20 to x 1 + 20, y 1 + 20.
do Menu "select".
if ll = 1, then
add r 4 to l n.
repeat l n,
do Menu "lighten".
end repeat.
end if.
do Menu "copy picture".
end repeat.
end thicken R.
- - - - - - - - - -

on verstippel R x 1, y 1, x 2, y 2.
edge R x 1 + 1, y 1 + 1, x 2 minus 1, y 2 minus 1.
lighten R x 1, y 1, x 2, y 2.
thicken R x 1, y 1, x 2, y 2.
end verstippel R.
- - - - - - - - - - - -
on zoom All,
global x max, y max.
put random x max div 5 into d x. -- source hookpunt.
put random y max div 5 into d y.
choose select tool.
drag from d x, d y to x max minus d x, y max minus d y.
drag from d x, d y to 0, 0, with option Key.
drag from x max minus 2 times d x, y max minus 2 times d y to x max, y max, with command Key.
end zoom All.
-- - - - - - - - - - - - -