rem Scribble Challenge
rem by TheComet
 
rem set display mode to maximum resolution possible
perform checklist for display modes
setwidth=0
setheight=0
for t=1 to checklist quantity()
   width=checklist value a(t)
   height=checklist value b(t)
   depth=checklist value c(t)
   if setwidth<width and setheight<height then setwidth=width:setheight=height:setdepth=depth
next t
set display mode setwidth,setheight,setdepth
set camera view 0,0,setwidth,setheight
 
rem setup screen
sync on
backdrop off
hide mouse
 
rem randomize
randomize timer()
 
rem set accuracy for b&#65533;zier curve
acc=20
 
rem setup dimensions
dotmax=1200
dim dotx(dotmax)
dim doty(dotmax)
 
rem generate random positions and mark with dots
width=screen width()
height=screen height()
for t=1 to dotmax
   dotx(t)=rnd(width*(acc/4))-(width*(acc/8))
   doty(t)=rnd(height*(acc/4))-(height*(acc/8))
next t
 
rem color backdrop white
ink rgb(255,255,255),0
box 0,0,width-1,height-1
 
rem set start point
startx=dotx(1)
starty=doty(1)
 
rem set end point
endx=dotx(dotmax)
endy=doty(dotmax)
 
rem dot in the middle of each line, join together, dot in the middle of each of the new lines, join together...
ink 0,0
for r=1 to acc
   if r=acc then line=1 else line=0
   oldx=startx
   oldy=starty
   for t=2 to dotmax
      middlex=(dotx(t-1)+dotx(t))/2
      middley=(doty(t-1)+doty(t))/2
      if t=dotmax then middlex=endx:middley=endy
      if line=1 then line oldx,oldy,middlex,middley
      dotx(t)=middlex:oldx=middlex
      doty(t)=middley:oldy=middley
   next t
   dotx(dotmax)=endx
   doty(dotmax)=endy
next r
 
rem end
suspend for key
end