
-----------------------------------
BigBear
Thu Apr 23, 2009 7:33 am

Spell Check
-----------------------------------
var Middle := count div 2
 var sent := "computer"
 var correct := false %Assumes it isn't in text file (spelled worng)
 var check : string     %reads from the file
 seek : fn, count
 get : fn, check
 put check
loop
 seek : fn, Middle
 get : fn, check
 if check < sent then
 Middle := Middle + (Middle div 2)
 elsif check > sent then
 Middle := Middle div 2
 elsif sent = check then
 correct := true
 exit
 end if
 exit when Middle = Target then
            last := Middle
        else
            first := Middle + 1
        end if
        exit when first >= last
    end loop
    if sent = Target then
        result first
    else
        result 0
    end if
    close : fn
end Search

proc Main
    var input : string
    var FileSize : int %:= 10000
    Load (FileSize)
    Drawi
    put FileSize
    loop
        get input
        put Search (input, "English.txt", FileSize)
    end loop
end Main

Main




This is my current method that I am trying to get working.

Attached is the array method which becomes to large, it also contains the text file.
