#!/usr/local/bin/blassic
p$="pmars -bkl 5 -s 80 -p 80 -c 800 -r 70 ":n=2000:d=50:l=5:c=41
i$="mov.spl.djn.dat.jmz.seq.sne.add.jmp.":k=9
m$="a b f i x abba":t=7:n$="$#@<>*{}":q=8:randomize
shell "dir /b 0.red>_":cls:open "_" for input as #3:if eof(3) then gosub i
close #3:while inkey$="":x=int(rnd*n):y=x:while y=x or y<0 or y>=n
y=x+int(rnd*3-1)+(int(rnd*3-1)*d):wend:x$=str$(x)+".red":y$=str$(y)+".red"
shell p$+x$+" "+y$+">_":open "_" for input as #3:input #3,z$:a=val(z$)
input #3,z$:b=val(z$):close #3:s$=x$:d$=y$:if a<b then s$=y$:d$=x$
open s$ for input as #1:open d$ for output as #2:input #1,z$:?#2,z$
i=0:while not eof(1) and i<l:line input #1,z$
if rnd<.01 and i<l-1 then if not eof(1) then line input #1,t$:?#2,t$:i=i+1
if rnd<.01 and i>0 then if not eof(1) then line input #1,z$
if rnd<.01 and i<l-1 then ?#2,z$:i=i+1
if rnd<.02 then gosub a
if rnd<.02 then gosub b
if rnd<.03 then p=7:gosub c
if rnd<.03 then p=8:gosub d
if rnd<.03 then p=14:gosub c
if rnd<.03 then p=15:gosub d
if rnd<.05 then p=8:gosub e
if rnd<.05 then p=15:gosub e
?#2,z$:i=i+1:wend:close #1:close #2:wend:end
label a:z$=mid$(i$,int(rnd^1.8*k)*4+1,4)+mid$(z$,5):return
label b:z$=left$(z$,4)+mid$(m$,int(rnd*t)*2+1,2)+mid$(z$,7):return
label c:z$=left$(z$,p)+mid$(n$,int(rnd*q)+1,1)+mid$(z$,p+2):return
label d:q$=left$(str$(int(rnd^2.5*c)*(int(rnd*2)*2-1))+"    ",5)
z$=left$(z$,p)+q$+mid$(z$,p+6):return
label e:e=(val(mid$(z$,p+1,5))+int(rnd*2)*2-1)mod c
z$=left$(z$,p)+left$(str$(e)+"    ",5)+mid$(z$,p+6):return
label i:for w=0 to n-1:open str$(w)+".red" for output as #2:?#2,";assert 1"
for i=1 to l:z$=space$(13)+",":gosub a:gosub b:p=7:gosub c:p=8:gosub d
p=14:gosub c:p=15:gosub d:?#2,z$:next i:close #2:next w:return
