I've made a small program that I think might be of use to some noobs as it uses quite a few different features of DB.
The program is based on the nature of infinity and uses the computer to randomly generate a word.
`setup
set display mode 1024,768,32
set gamma 0,0,0 : `turn the screen black
hide mouse
sync on : sync rate 0
randomize timer()
`make message array to store numbered lines
DIM msg$(4)
msg$(0)="I'm sure you've heard of this explanation of the nature of infinity:"
msg$(1)="If you sat a monkey in front of a type-writer and gave it an infinite amount of time, it would eventually type the complete works of Shakespeare."
msg$(2)="I want to apply this theory to a computer."
msg$(3)="I will test the computer by seeing how long it takes to randomly construct the word 'THE'."
msg$(4)="Press Any Key To Continue"
cls 128 : `clear the screen blue
`fade in the screen
FOR ga = 0 to 255
set gamma ga,ga,ga
sync
NEXT ga
`print intro message
FOR ln = 0 to 4
if ln=1 then set text to italic else set text to normal : `only the quoted line needs to be italic
`print line fading from background colour to white
for ga = 0 to 255
ink rgb(ga,ga,128+(ga/2)),128
center Text 512,10+(ln*15),msg$(ln)
sync
next ga
wait len(msg$(ln))*20 : `pause to let user read the line
next ln
wait key
set text opaque : `make text overwrite itself so we don't have to clear screen
target$="THE"
try=0
`MAIN LOOP
Repeat
inc try,1
word$=""
`add the same number of letters as the target string has to word string
for chr = 1 to len(target$)
ascii=rnd(25)+65 : `get random letter and add to get correct ascii number
word$=word$+chr$(ascii)
next chr
`only update screen every 10 tries
if try/10 = try/10.
center text 512,330," Try #"+str$(try)+": "+word$ + " "
SYNC
endif
Until word$=target$
`display successful try
center text 512,330," Try #"+str$(try)+": "+word$+" "
center text 512,360,"Success!"
SYNC
Wait key
end
"You must be someone's friend to make comments about them." - MySpace lied.
