Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Your best "Hello, world!" program in FreeBasic
#50
Inspired by the movie War Games:

Code:
'' compile with fbc version
dim target as string = "Hello, world!"
dim matches(0 to len(target) - 1) as integer
dim numMatches as integer = 0
dim test as string = space(13)

randomize timer
cls
do
    dim i as integer
    for i = 0 to len(target) - 1
        if not matches(i) then
            do
                test[i] = int(rnd * 256)
            loop while test[i] < 32
            
            if test[i] = target[i] then
                matches(i) = -1
                numMatches += 1
            end if
        end if
    next

    locate 1,1 : print test : sleep 50
        
    if numMatches = len(target) then exit do
loop
stylin:
Reply


Messages In This Thread
Your best "Hello, world!" program in FreeBasic - by stylin - 02-20-2007, 11:18 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)