RANDOMIZE TIMER
CLEAR ALL
BACKGROUND RGB(32,32,32)
c1=RGB(255,255,255)
c2=RGB(255,255,0)
dist=128
s=9876543
amplitude=256
octaves=8
persistence=150
rgbflag=1
DO
    BITMAP 1 TEXTURE "perlinnoise",EXPORT$(dist,s,amplitude,octaves,persistence,rgbflag)
    SPRITE 1 BIND BITMAP 1 SHOW SCALE 2,2
    CLS
    PRINT
    INK c1:PRINT "(1) Dist          : ";:INK c2:PRINT dist
    INK c1:PRINT "(2) Seed          : ";:INK c2:PRINT s
    INK c1:PRINT "(3) Amplitude     : ";:INK c2:PRINT amplitude
    INK c1:PRINT "(4) Octaves       : ";:INK c2:PRINT octaves
    INK c1:PRINT "(5) Persistence   : ";:INK c2:PRINT persistence
    INK c1:PRINT "(R) Random"
    INK c1:PRINT "(Q) Quit"
    PRINT
    LOCATE ,TEXT.ROWS-1:PRINT "Press SPACE to toggle color.";
    GETKEY a$
    IF a$>="1" AND a$<="5" THEN
        y=VAL(a$)
        INK c2
        LOCATE 21,y+1:PRINT SPACE$(10)
        LOCATE 21,y+1:LINE INPUT d$
        d=VAL(d$)
        IF y=1 THEN dist=d
        IF y=2 THEN s=d
        IF y=3 THEN amplitude=d
        IF y=4 THEN octaves=d
        IF y=5 THEN persistence=d
    ELSE IF a$="r" THEN
        dist=RANGE(1,16)*8
        s=RANGE(1000000,9999999)
        amplitude=RANGE(8,16)*16
        octaves=RANGE(4,16)
        persistence=RANGE(100,200)
    ELSE IF a$=" " THEN
        rgbflag=1-rgbflag
    ELSE IF a$="q" THEN
        EXIT DO
    END IF
LOOP
END
