All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General
Fill in the blanks. (Posted on 2004-09-22) Difficulty: 2 of 5
What three letter word best completes the below words?
SW...
...Y
AL...
F...
W...

See The Solution Submitted by SilverKnight    
Rating: 2.6364 (11 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution I didn't swink too long on this one (Solution) | Comment 6 of 15 |
My VB program scanned my 354,508 word unabridged dictionary in one second to find the only answer valid for words therein:
 
SWARM
ARMY
ALARM
FARM
WARM
 
 
Imports System
Imports System.IO
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.Math
Module Module1
    Sub Main()
        Randomize()
        Dim strstarttime As String
        Dim strend As String
        Dim stranswer As String
        Dim intlastindex As Integer = -1
        Dim strwordlist1(1000) As String
        Dim strwordlist2(1000) As String
        Dim strwordlist3(1000) As String
        Dim strwordlist4(1000) As String
        Dim strwordlist5(1000) As String
        Dim intloop As Integer = 999
        Dim intloop1 As Integer
        Dim intloop2 As Integer
        Dim intloop3 As Integer
        Dim intloop4 As Integer
        Dim intloop5 As Integer
        strstarttime = TimeOfDay
        Console.WriteLine( _
        strstarttime & ": Start of execution.")
        For index1 As Integer = 0 To intloop
            strwordlist1(index1) = " "
            strwordlist2(index1) = " "
            strwordlist3(index1) = " "
            strwordlist4(index1) = " "
            strwordlist5(index1) = " "
        Next
        buildtable(intloop, _
        strwordlist1, intloop1, _
        strwordlist2, intloop2, _
        strwordlist3, intloop3, _
        strwordlist4, intloop4, _
        strwordlist5, intloop5)
        Console.WriteLine( _
        Str(intloop1 + 1) & " sw??? words loaded.")
        Console.WriteLine( _
        Str(intloop2 + 1) & " ???y words loaded.")
        Console.WriteLine( _
        Str(intloop3 + 1) & " al??? words loaded.")
        Console.WriteLine( _
        Str(intloop4 + 1) & " f??? words loaded.")
        Console.WriteLine( _
        Str(intloop5 + 1) & " w??? words loaded.")
        Console.WriteLine("Press ENTER to continue.")
        For index1 As Integer = 0 To intloop1
            findwords1(stranswer, _
            strwordlist1, intloop1, _
            strwordlist2, intloop2, _
            strwordlist3, intloop3, _
            strwordlist4, intloop4, _
            strwordlist5, intloop5, _
            index1)
        Next
        Console.WriteLine( _
        strstarttime & ": Start of execution.")
        Console.WriteLine( _
        TimeOfDay & ": End of execution.")
        strend = "?"
        Console.WriteLine(" ")
        While strend <> "x"
            Console.WriteLine( _
            "Please enter X to exit program.")
            strend = LCase(Console.ReadLine())
        End While
    End Sub

    Sub findwords1(ByRef stranswer, _
    ByRef strwordlist1, ByRef intloop1, _
    ByRef strwordlist2, ByRef intloop2, _
    ByRef strwordlist3, ByRef intloop3, _
    ByRef strwordlist4, ByRef intloop4, _
    ByRef strwordlist5, ByRef intloop5, _
    ByRef index1)
        Dim strwork(5) As String
        Dim strline As String
        Dim intsub As Integer
        strline = strwordlist1(index1)
        intsub = 0
        For index99 As Integer = 1 To Len(strline)
            strwork(intsub) = Mid(strline, index99, 1)
            intsub += 1
        Next
        stranswer = _
        strwork(2) & strwork(3) & strwork(4)
        For index2 As Integer = 0 To intloop2
            findwords2(stranswer, _
                strwordlist1, intloop1, _
                strwordlist2, intloop2, _
                strwordlist3, intloop3, _
                strwordlist4, intloop4, _
                strwordlist5, intloop5, _
                index1, index2)
        Next
    End Sub

    Sub findwords2(ByRef stranswer, _
    ByRef strwordlist1, ByRef intloop1, _
    ByRef strwordlist2, ByRef intloop2, _
    ByRef strwordlist3, ByRef intloop3, _
    ByRef strwordlist4, ByRef intloop4, _
    ByRef strwordlist5, ByRef intloop5, _
    ByRef index1, ByRef index2)
        Dim strwork(4) As String
        Dim strline As String
        Dim intsub As Integer
        strline = strwordlist2(index2)
        intsub = 0
        For index99 As Integer = 1 To Len(strline)
            strwork(intsub) = Mid(strline, index99, 1)
            intsub += 1
        Next
        If stranswer = _
        strwork(0) & strwork(1) & strwork(2) Then
            For index3 As Integer = 0 To intloop3
                findwords3(stranswer, _
                    strwordlist1, intloop1, _
                    strwordlist2, intloop2, _
                    strwordlist3, intloop3, _
                    strwordlist4, intloop4, _
                    strwordlist5, intloop5, _
                    index1, index2, index3)
            Next
        End If
    End Sub

    Sub findwords3(ByRef stranswer, _
    ByRef strwordlist1, ByRef intloop1, _
    ByRef strwordlist2, ByRef intloop2, _
    ByRef strwordlist3, ByRef intloop3, _
    ByRef strwordlist4, ByRef intloop4, _
    ByRef strwordlist5, ByRef intloop5, _
    ByRef index1, ByRef index2, ByRef index3)
        Dim strwork(5) As String
        Dim strline As String
        Dim intsub As Integer
        strline = strwordlist3(index3)
        intsub = 0
        For index99 As Integer = 1 To Len(strline)
            strwork(intsub) = Mid(strline, index99, 1)
            intsub += 1
        Next
        If stranswer = _
        strwork(2) & strwork(3) & strwork(4) Then
            For index4 As Integer = 0 To intloop4
                findwords4(stranswer, _
                    strwordlist1, intloop1, _
                    strwordlist2, intloop2, _
                    strwordlist3, intloop3, _
                    strwordlist4, intloop4, _
                    strwordlist5, intloop5, _
                    index1, index2, index3, _
                    index4)
            Next
        End If
    End Sub

    Sub findwords4(ByRef stranswer, _
    ByRef strwordlist1, ByRef intloop1, _
    ByRef strwordlist2, ByRef intloop2, _
    ByRef strwordlist3, ByRef intloop3, _
    ByRef strwordlist4, ByRef intloop4, _
    ByRef strwordlist5, ByRef intloop5, _
    ByRef index1, ByRef index2, ByRef index3, _
    ByRef index4)
        Dim strwork(4) As String
        Dim strline As String
        Dim intsub As Integer
        strline = strwordlist4(index4)
        intsub = 0
        For index99 As Integer = 1 To Len(strline)
            strwork(intsub) = Mid(strline, index99, 1)
            intsub += 1
        Next
        If stranswer = _
        strwork(1) & strwork(2) & strwork(3) Then
            For index5 As Integer = 0 To intloop5
                findwords5(stranswer, _
                    strwordlist1, intloop1, _
                    strwordlist2, intloop2, _
                    strwordlist3, intloop3, _
                    strwordlist4, intloop4, _
                    strwordlist5, intloop5, _
                    index1, index2, index3, _
                    index4, index5)
            Next
        End If
    End Sub

    Sub findwords5(ByRef stranswer, _
    ByRef strwordlist1, ByRef intloop1, _
    ByRef strwordlist2, ByRef intloop2, _
    ByRef strwordlist3, ByRef intloop3, _
    ByRef strwordlist4, ByRef intloop4, _
    ByRef strwordlist5, ByRef intloop5, _
    ByRef index1, ByRef index2, ByRef index3, _
    ByRef index4, ByRef index5)
        Dim strwork(4) As String
        Dim strline As String
        Dim intsub As Integer
        strline = strwordlist5(index5)
        intsub = 0
        For index99 As Integer = 1 To Len(strline)
            strwork(intsub) = Mid(strline, index99, 1)
            intsub += 1
        Next
        If stranswer = _
        strwork(1) & strwork(2) & strwork(3) Then
            Console.WriteLine( _
            strwordlist1(index1) & " " & _
            strwordlist2(index2) & " " & _
            strwordlist3(index3) & " " & _
            strwordlist4(index4) & " " & _
            strwordlist5(index5))
            Console.WriteLine( _
            "Press ENTER to continue")
        End If
    End Sub

    Sub buildtable(ByRef intloop, _
    ByRef strwordlist1, ByRef intloop1, _
    ByRef strwordlist2, ByRef intloop2, _
    ByRef strwordlist3, ByRef intloop3, _
    ByRef strwordlist4, ByRef intloop4, _
    ByRef strwordlist5, ByRef intloop5)
        Dim strword As String
        Dim strprevword As String
        Dim objStreamReader As StreamReader
        objStreamReader = _
        New StreamReader("C:\VB.WORD.MASTER")
        Console.WriteLine("Beginning word list build...")
        strprevword = " "
        While 100 > 0
            strword = objStreamReader.ReadLine
            strword = LCase(strword)
            If strword <= " " Then
                Exit While
            End If
            If strword <= strprevword Then
                Console.WriteLine( _
                strword & " <= " & strprevword)
                strprevword = "??????"
                Exit While
            End If
            strprevword = strword
            If Len(strword) = 4 Then
                If strword Like "*y" Then
                    putintable(strword, intloop, _
                    strwordlist2, intloop2)
                ElseIf strword Like "f*" Then
                    putintable(strword, intloop, _
                    strwordlist4, intloop4)
                ElseIf strword Like "w*" Then
                    putintable(strword, intloop, _
                    strwordlist5, intloop5)
                End If
            End If
            If Len(strword) = 5 Then
                If strword Like "sw*" Then
                    putintable(strword, intloop, _
                    strwordlist1, intloop1)
                ElseIf strword Like "al*" Then
                    putintable(strword, intloop, _
                    strwordlist3, intloop3)
                End If
            End If
            If strword = "????????" Then
                Exit While
            End If
        End While
        objStreamReader.Close()
        If strprevword = "??????" Then
            For index1 As Integer = 0 To 9
                Console.WriteLine("ERROR !!!!!")
            Next
            Console.WriteLine( _
            "Wordlist master file is not in ascending sequence.")
            Console.ReadLine()
            End
        End If
        If strword = "????????" Then
            Console.WriteLine("ERROR !!!!!")
            Console.WriteLine("Increase size of tables.")
            Console.ReadLine()
            End
        End If
    End Sub

    Sub putintable(ByRef strword, ByRef intloop, _
    ByRef strwordlistx, ByRef intloopx)
        If strwordlistx(intloop) <> " " Then
            strword = "????????"
            Exit Sub
        End If
        For index99 As Integer = 0 To intloop
            If strwordlistx(index99) = " " Then
                strwordlistx(index99) = strword
                intloopx = index99
                Exit Sub
            End If
        Next
    End Sub
End Module

  Posted by Penny on 2004-09-22 12:54:47
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (11)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information