DECLARE SUB invert (source AS STRING, target AS STRING)
CLS
COLOR 1
PRINT "In this program you enter a verbal spell you wish to do and it will"
PRINT "tell the words to you. To quit type Q"
DO
LOOP UNTIL INKEY$ <> ""
DO
CLS
COLOR 2
LOCATE 1, 1
PRINT "Enter a verbal spell: ";
COLOR 4
INPUT "", word$
COLOR 1
invert (word$), backward$
PRINT "TRANSLATION: ";
COLOR 4
IF word$ = "Q" OR word$ = "q" OR word$ = "Quit" OR word$ = "quit" OR word$ = "QUIT" THEN
        ccc = 7
ELSE
ccc = INT(RND * 7) + 1
END IF
IF word$ = "Q" OR word$ = "q" OR word$ = "Quit" OR word$ = "quit" OR word$ = "QUIT" AND ccc = 7 THEN
        COLOR 2
        PRINT "Thank you for using The Spell Translator goodbye!"
ELSEIF ccc = 1 THEN
        COLOR 4
        PRINT "This spell has only worked once on record. ";
        COLOR 2
        PRINT backward$
ELSEIF ccc = 2 THEN
        COLOR 4
        PRINT "The spell you have typed does not work or is illegal."
ELSEIF ccc = 3 THEN
        COLOR 2
        PRINT "This spell works very nicely! ";
        COLOR 4
        PRINT backward$
ELSEIF ccc = 4 THEN
        COLOR 2
        PRINT backward$
        COLOR 4
        PRINT "This spell involves other things than just words. ";
        COLOR 2
        PRINT "SEE: ";
        COLOR 1
        PRINT "The Big Book of Spells"
ELSE
        COLOR 2
        PRINT backward$
END IF
DO
LOOP UNTIL INKEY$ <> ""
LOOP UNTIL word$ = "Q" OR word$ = "q" OR word$ = "Quit" OR word$ = "quit" OR word$ = "QUIT"
CHAIN "c:\windows\profiles\alex\desktop\q-basi~1\gameinto"

SUB invert (source AS STRING, target AS STRING)
target$ = source$
length = LEN(source$)
FOR x = 1 TO length
        MID$(target$, length + 1 - x, 1) = MID$(source$, x, 1)
NEXT x
END SUB

