A
» Every piece of a proverb must be inside quotation
marks on a line that begins with the word data
followed by a space.
» The first and second blocks of data must contain
an equal number of lines.
» If you change that number, you must substitute
your new value instead of the number 40 in the
statement np= 40 on line 3 of the program.
I’ve reproduced some samples of the output in
Figure B. I especially like Anger cannot buy happiness
and The darkest hour makes you stronger. I’m intrigued
by God in his wisdom kills, but a bit skeptical about
Crime is a thing of beauty. What pseudointelligent combinations can your version of the program create?
Back in the day — which was during the 1980s —
computer magazines published a lot of listings like
this, and some people who got hooked on BASIC
went on to become career programmers. Not so
many people play with BASIC anymore, but it’s still
fun and is well suited to natural-language processing. If you want to understand how it works, study
one of the many online tutorials. Then you can try
to build your own artificial-intelligence software to
accept user input and cycle it back in seemingly
meaningful responses.
Maybe you can even write software that passes
the Turing test — although so far, no one has
succeeded.
Fig. A: In JustBASIC
the program listing
should look like this
(it will appear in one
long column).
Fig. B: Sample output
from the Proverbs
program.
Sample output from the Proverbs program:
Absolute power is a dangerous thing.
The darkest hour makes you stronger.
Curiosity is the root of all evil.
Impulsive behavior is best forgotten.
Anger cannot buy happiness.
Envy leads to a life of regret.
Haste comes before a fall.
Love pleases no one.
Heaven above is better than nothing.
God in his wisdom kills.
Crime is a thing of beauty.
B
BASIC Incompatibilities
Computer languages have regional dialects, like
human languages. The idiosyncracies of JustBASIC
include the peculiar syntax on line 2 of the listing,
which reseeds the random number generator. It
also allows the commands do and loop, which are
not universal. If you try to run this program using
a different interpreter, you may need to rewrite
these lines. If you modify the program in JustBASIC
you should be aware that it doesn’t allow you to
read data directly into an array, and its input$()
function doesn’t recognize the Esc key.
For a really powerful version of BASIC that
accesses all the features of Windows, I recommend
PowerBASIC, which is extremely fast and versatile.
Charles Platt is a section editor for MAKE.
Make: 97