'By Fryer - Please Upload.
'Sii - By R.Fryer

dim n(10,5)
for n=0 to 9
    for i=1 to 5
        read n(n,i)
    next i
next n
data 7,5,5,5,7,2,2,2,2,2,7,1,7,4,7,7,1,7,1,7
data 5,5,7,1,1,7,4,7,1,7,7,4,7,5,7,7,1,1,1,1
data 7,5,7,5,7,7,5,7,1,7
dim bbx(10),bby(10),bbmx(10),bbmy(10)
dim sne(9),cse(9)
for i=1 to 9
  sne(i)=sin(pi/4*i)*4.5
  cse(i)=cos(pi/4*i)*4
next i
dim ex(5),ey(5),ec(5)
dim px(90),py(70)
for s=1 to 10
  for p=1 to 6
    a=pi/3*p+ran(pi/2)
    px(p*10+s)=s*5*sin(a)-ran(12)+6
    py(p*10+s)=s*2.5*cos(a)-ran(12)+6
  next p
next s
dim sn(360),cs(360)
for i=0 to 360
    sn(i)=60+15*sin(i/180*pi)
    cs(i)=60+15*cos(i/180*pi)
next i
em=25
open window 640,512
dim fire_x(10),fire_y(10),en_x(em),en_y(em),en_xp(1042)
dim ao(em)
for i=0 to 1024
  en_xp(i)=100*sin(i/20)
next i
legmove=1:legs=15:emx=em

x=320:y=350
for i=1 to em
  ao(i)=0
  en_x(i)=ran(600)+20
  en_y(i)=-ran(100)
next i
sp=.1:mx_drop=1:count=0:em=3
energy=0:energyt=256:score=0:ten=0:unit=1

setrgb 0,0,0,0
label loop
  setdispbuf ss:ss=1-ss:setdrawbuf ss
  bc=bc+1.56
  if bc>360 bc=0
  setrgb 1,20,10,cs(bc)
  setrgb 2,20,10,cs(bc)
  setrgb 3,20,10,sn(bc)
  gtriangle 0,0 to 640,0 to 0,512
  setrgb 2,20,10,sn(bc)
  gtriangle 640,0 to 0,512 to 640,512
if n_lev=0 goto no_new
setrgb 1,60,0,60
    l=0
    t=ten
    repeat
        i=0
        repeat i=i+1
            n=n(t,i)
            yn=n_lev*5+i*50-250
            k=0
            repeat
                xn=300-50*k+l
                b=2^k
if and(n,b)=b fill rectangle xn-50,yn-50 to xn,yn
                k=k+1
            until(k=3)
        until(i=5)
        l=l+200
        t=unit
    until(l=400)
label no_new
  f=-50:dy=mod(dy+5,50)
  setrgb 1,20,30,90
  repeat f=f+50
    fill rectangle f+5,0 to f-5,512
    fill rectangle 0,f+dy+5 to 640,f-5+dy
  until(f=600)
  f=-50
  repeat f=f+50
    clear fill rectangle f,0 to f+2,512
    clear fill rectangle 0,f+dy to 640,f+2+dy
  until(f=600)
  setrgb 3,135,0,40
  f=0
  r=ran(255)
  repeat f=f+1
    ep=ec(f)
    if ep=0 goto no_exp2
    ecnt=0
    ex=ex(f)
    ey=ey(f)
    col=300-30*ep
    setrgb 1,col,col,40
    setrgb 2,col,col,40
    repeat ecnt=ecnt+1
      eex=ex+ep*sne(ecnt)
      eey=ey+ep*cse(ecnt)
      if ecnt>1 gtriangle eex,eey to ox,oy to ex,ey
      ox=eex:oy=eey
    until(ecnt=9)
    ecnt=0
    setrgb 1,255,r,0
    repeat ecnt=ecnt+10
      e=ecnt+ep
      eex=ex+px(e)
      eey=ey+py(e)
      fill triangle eex,eey to eex+3,eey+4 to eex+5,eey-2
    until(ecnt=60)
    ec(f)=mod(ep+1,11)
label no_exp2
  until(f=5)
  last=j:j=peek("port1")
  mx=max(min(mx+and(j,32)/32-and(j,128)/128,8),-8)
  if mx>0 mx=mx-.5
  if mx<0 mx=mx+.5
  x=max(min(x+mx,600),40)
  my=max(min(my+and(j,64)/64-and(j,16)/16,8),-8)
  if my>0 my=my-.5
  if my<0 my=my+.5
  y=max(min(y+my,470),40)
  f_loop=0:f_free=0
  setrgb 1,255,ran(255),0
  repeat f_loop=f_loop+1
    if f_loop>4 goto no_fire1
    fy=fire_y(f_loop)-10
    if fy=-10 and f_free=0 f_free=f_loop
    if fy=-10 goto no_fire1
    fx=fire_x(f_loop)+en_xp(fy*2)/40
    fill rectangle fx-2,fy to fx+2,fy+20
    if fy<10 fy=0
    fire_y(f_loop)=fy
label no_fire1
    by=bby(f_loop)
    if by=0 goto no_bomb
    bmy=bbmy(f_loop)+.2
    bmx=bbmx(f_loop)
    bx=bbx(f_loop)+bmx
    by=by+bmy
    gtriangle bx,by to bx-6,by-18 to bx+6,by-18
    bbmy(f_loop)=bmy
    bby(f_loop)=by
    bbx(f_loop)=bx
    if by<y or by>y+60 goto no_hit
    if bx<x-15 or bx>x+15 goto no_hit
    bby(f_loop)=0
    ec=1+mod(ec,4)
    ex(ec)=bx
    ey(ec)=by
    ec(ec)=1
    energyt=energyt-12
label no_hit
    if by<512 and bx>0 and bx<640 goto no_bomb
    bby(f_loop)=0
label no_bomb
  until(f_loop=8)
  if and(j,16384)=0 goto no_fire2
  if f_free=0 or and(last,16384)>0 goto no_fire2
  fire_x(f_free)=x
  fire_y(f_free)=y
label no_fire2
        sr=sr+1
        if sr>10 sr=sr-20
        setrgb 1,200,200,0
        setrgb 2,150,0,0
        setrgb 3,150,0,0
gtriangle x,y+40 to x-4,y+60+ss*6 to x+4,y+60+ss*6
        setrgb 1,0,0,255
gtriangle x,y+10 to x+15,y+50+mx to x-15,y+50-mx
        setrgb 1,0,255,0
gtriangle x,y to x-5-abs(sr),y+20 to x+5+abs(sr),y+20
  legs=legs+legmove
  if legs=25 or legs=10 legmove=-legmove
  en=0
  setrgb 1,200,200,0
  setrgb 2,200,0,200
  setrgb 3,200,0,200
  tot=0
  repeat en=en+1
    if ao(en)=0 goto no_col
    tot=1
    ay=en_y(en)
    if ay<512 goto jmp
      en_x(en)=ran(600)+20
      ay=-ran(80)-20
      if em=emx ao(en)=0
label jmp
    ay=ay+1
    ax=en_x(en)+en_xp(ay+100)*sp
    en_y(en)=ay
    gtriangle ax,ay-10 to ax-20,ay to ax+20,ay
    gtriangle ax-20,ay to ax-15,ay to ax-legs,ay+10
    gtriangle ax+20,ay to ax+15,ay to ax+legs,ay+10
    f_loop=0
    d=ran(100)
    repeat f_loop=f_loop+1
      if fire_y(f_loop)=0 goto no_col
      cx=ax-fire_x(f_loop)
      if abs(cx)>20 goto no_col
      cy=ay-fire_y(f_loop)
      if abs(cy)>10 goto no_col
      ec=1+mod(ec,4)
      ex(ec)=ax
      ey(ec)=ay
      ec(ec)=1
      en_x(en)=ran(600)+20
      en_y(en)=-ran(80)-20
      fire_y(f_loop)=0
      if em=emx ao(en)=0
      count=count+1
      em=min(3+int(count/2),emx)
label no_col
    if f_loop>mx_drop goto no_drop
    if d>1 or dropped=1 goto no_drop
    if bby(f_loop)>0 or ay<=0 goto no_drop
    bbx(f_loop)=ax
    bby(f_loop)=ay+10
    bbmx(f_loop)=(en_xp(ay+100)-en_xp(ay+99))*sp
    bbmy(f_loop)=0
    dropped=1
label no_drop
    until(f_loop=8)
    if ay<y-10 or ay>y+60 goto no_hit2
    if ax<x-25 or ax>x+25 goto no_hit2
    en_x(en)=ran(600)+20
    en_y(en)=-10
    if em=emx ao(en)=0
    ec=1+mod(ec,4)
    ex(ec)=ax
    ey(ec)=ay
    ec(ec)=1    
    energyt=energyt-24
    em=min(3+int(count/2),emx)
label no_hit2
  until(en=em)
  dropped=0
  if tot=1 goto jmp2
  if n_lev=30 energyt=int(min(energyt+count/2,255))
  if n_lev>0 or dy=0 n_lev=n_lev+1
  if n_lev<200 goto jmp2
  if unit=9 ten=ten+1
  unit=mod(unit+1,10)
  n_lev=0
  sp=sp+.1
  for i=1 to emx
    ao(i)=1
    en_x(i)=ran(600)+20
    en_y(i)=-ran(100)
  next i
  if int(unit/2)=unit/2 mx_drop=min(mx_drop+1,8)
  count=0:em=3
label jmp2
  setrgb 1,255,255,255
  rectangle 48,478 to 308,492
  setrgb 1,255,energy,0
  energyt=max(energyt,0)
  if energyt>energy energy=energy+1
  if energyt<energy energy=max(energy-1,0)
  fill rectangle 50,480 to 50+energy,490
goto loop












