I just rediscovered this simple, amusing program in my archives. At one
time, I copied it out of a book "Using QuickBASIC", by Inman and
Albrecht. I have made some minor updates, but it is largely the
original stuff. I don't think the authors would mind. Their book has
been out of print for many years now.
'-------------------------- START CODE ----------------------------
' MAKEWORD.BAS - a random word generator program
$LIB ALL OFF
DECLARE FUNCTION MakeWord$ (Template$)
RANDOMIZE TIMER
COLOR 7, 1
CLS
PRINT " This program invents random words. You tell it what kind to make"
PRINT " by giving it a mask that tells it the 'layout' of the words you
ant."
PRINT " In the mask, a 'C' stands for a consonant, a 'V' for a vowel.
PRINT " A word like 'SING' would have a mask of CVCC, while 'ACE' is VCV."
DO
PRINT
LINE INPUT " Type a template of C's and V's (e.g. CVCC): "; Template$
IF LEN(Template$) = 0 THEN EXIT LOOP
Template$ = UCASE$(Template$)
PRINT
LINE INPUT " How many words do you want created (0 to quit): "; NumWords$
Number% = VAL(NumWords$)
IF Number% = 0 THEN EXIT LOOP
PRINT
FOR Rep% = 1 TO Number%
PRINT MakeWord$(Template$),
NEXT Rep%
PRINT
LOOP
END
'=======================================
FUNCTION MakeWord$ (Template$)
'=======================================
FOR X% = 1 TO LEN(Template$)
ConsOrVow$ = MID$(Template$, X%, 1)
IF ConsOrVow$ = "C" THEN
RandomCons% = INT(21 * RND(1)) + 1
Consonant$ = MID$("bcdfghjklmnpqrstvwxyz", RandomCons%, 1)
Word$ = Word$ + Consonant$
ELSEIF ConsOrVow$ = "V" THEN
RandomVow% = INT(6 * RND(1)) + 1
Vowel$ = MID$("aeiouy", RandomVow%, 1)
Word$ = Word$ + Vowel$
END IF
NEXT X%
MakeWord$ = Word$
END FUNCTION
'----------------------------- END CODE ----------------------------
* SLMR 2.1a * MAXLIB For PB v1.1 - Access arrays and files in EMS/XMS!
--- WILDMAIL!/WC v4.12
---------------
* Origin: Com-Dat BBS - Hillsboro, OR. HST DS (1:105/314.0)
|