Solves 3x3 word puzzle
#1
In a 3x3 box, find the words that match in rows and columns:

For example:

  A A H
  A C E
  H E M

Code:
CLS ' 68188 solutions.
DIM words(5000) AS STRING * 3
DIM array(1 TO 3) AS STRING * 3
OPEN "text2.dic" FOR INPUT AS #1
x = 0
DO
    IF EOF(1) THEN EXIT DO
    LINE INPUT #1, a$
    a$ = RTRIM$(a$)
    IF LEN(a$) = 3 THEN
        IF LCASE$(a$) = a$ THEN
            x = x + 1
            words(x) = a$
        END IF
    END IF
LOOP
t = x * x * x
FOR l1 = 1 TO x
    FOR l2 = 1 TO x
        'PRINT words(l1); " "; words(l2)
        FOR l3 = 1 TO x
            z = z + 1
            p = INT((z / t) * 100)
            IF p > c THEN
                c = p
                PRINT c; "%"
            END IF
            ' load array of 3-letter words.
            array(1) = words(l1)
            array(2) = words(l2)
            array(3) = words(l3)
            ' check vertical words.
            FOR ll = 1 TO 3
                l1$ = MID$(array(1), ll, 1)
                l1$ = l1$ + MID$(array(2), ll, 1)
                l1$ = l1$ + MID$(array(3), ll, 1)
                ' search for vertical word.
                flag = 0
                FOR lx = 1 TO x
                    IF words(lx) = l1$ THEN
                        flag = -1
                        EXIT FOR
                    END IF
                NEXT
                IF flag = 0 THEN
                    GOTO nextmatch
                END IF
            NEXT
            ' count\display array.
            q = q + 1
            PRINT "Solution"; q
            PRINT
            PRINT UCASE$(array(1))
            PRINT UCASE$(array(2))
            PRINT UCASE$(array(3))
            PRINT
            nextmatch:
        NEXT
    NEXT
NEXT
PRINT
END

You will need to download the attached dictionary..


Attached Files .zip   DICTION.ZIP (Size: 256.17 KB / Downloads: 3)
dndbbs project:

Links to my MUD: (strictly 16-bit); AKA XP:

Dndbbs executables
http://www.filegate.net/pdn/pdnbasic/dnd50a1e.zip

Dndbbs source
http://www.filegate.net/pdn/pdnbasic/dnd50a1s.zip

Dndbbs upgrade
http://www.filegate.net/pdn/pdnbasic/dnd50a1u.zip

DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor Utilities - https://bit.ly/EriksUtils
QB45 files: - https://bit.ly/EriksQB45 QB64shell - https://bit.ly/QB64shell Some old QB64 versions: - https://bit.ly/OldQB64
Reply
#2
Finds all words with AEIOU in them in order:

Code:
OPEN "text2.dic" FOR INPUT AS #1
v$ = UCASE$("aeiou")
DO
    IF EOF(1) THEN END
    LINE INPUT #1, a$
    a$ = UCASE$(a$)
    b$ = ""
    FOR l = 1 TO LEN(a$)
        z$ = UCASE$(MID$(a$, l, 1))
        IF INSTR(v$, z$) THEN
            b$ = b$ + z$
        END IF
    NEXT
    IF UCASE$(b$) = UCASE$(v$) THEN
        PRINT a$
    END IF
LOOP
END
dndbbs project:

Links to my MUD: (strictly 16-bit); AKA XP:

Dndbbs executables
http://www.filegate.net/pdn/pdnbasic/dnd50a1e.zip

Dndbbs source
http://www.filegate.net/pdn/pdnbasic/dnd50a1s.zip

Dndbbs upgrade
http://www.filegate.net/pdn/pdnbasic/dnd50a1u.zip

DNDDOOR - https://bit.ly/EriksDNDDoor DUNGEON - https://bit.ly/EriksDungeon
Interpreter - https://bit.ly/EriksSICK Hex Editor - https://bit.ly/EriksHexEditor Utilities - https://bit.ly/EriksUtils
QB45 files: - https://bit.ly/EriksQB45 QB64shell - https://bit.ly/QB64shell Some old QB64 versions: - https://bit.ly/OldQB64
Reply