UPLOAD image

Make Your PC (Seem) Intelligent

image

Can your computer pass the Turing test?

By Charles Platt

Can machines be intelligent? Computer pioneer Alan Turing suggested a test: put a person in front of a keyboard, communicating with a computer hidden at another location. If the computer can convince the person that he’s interacting with a human being, then for all practical purposes the computer is intelligent. This came to be known as the Turing test.

The trouble is, a computer can simulate intelligence without actually being intelligent. As a very simple example, here’s a tiny program that you can type in and modify, to fake the seemingly intelligent process of offering advice via proverbs.

I chose to use proverbs because I think they’re not really as smart as they seem. Also, new proverbs are easy to construct because so many of them follow the same basic format of subject, verb, and outcome.

For example, if you take “pride comes before a fall” and “crime doesn’t pay,” you can swap their subjects to get “pride doesn’t pay” or “crime comes before a fall,” and the new versions still seem to make sense.

I wrote the program in BASIC (Beginner’s All-purpose Symbolic Instruction Code) because even though it’s an old and limited computer language, it’s still the easiest for nonprogrammers to use, and it’s freely available online. In the tradition of MAKE, my program encourages you to hack it. You can insert different text to create new proverbs of your own design.

1. INSTALL THE PROGRAMMING LANGUAGE

Mac users can try Chipmunk BASIC from nicholson.com/rhn/basic; the setup instructions are a little too lengthy to include here. For Windows users I suggest JustBASIC, a small but simple interpreter that costs nothing. Download it from justbasic.com/download.html and install it, and you can run it without concern for viruses.

2. DOWNLOAD THE PROVERBS CODE

Ignore the little splash screen about “The World of JustBASIC” and click the window behind it. Now you can copy-type the listing from Figure A (press Enter at the end of each line), or download our copy: Program-pc.txt from makezine.com/15/upload_proverbs. In the JustBASIC File menu, choose Insert File and open your downloaded copy. On the Mac, download Program-mac.txt, open it in a text editor, copy all the text, and paste it into the BASIC window.

image

Fig. A: In JustBASIC the program listing should look like this (it will appear in one long column).

3. RUN THE PROGRAM

Press Shift-F5 to run the Proverbs program (or Command-R on the Mac). If nothing seems to happen, check the status bar at the bottom of the window for messages such as “syntax error.” Correct your typing and try again. When the program runs successfully, it opens its own window displaying up to 40 new proverbs without repeating any pieces of them. Because the random number generator is reseeded by the system clock near the beginning, the program is likely to create entirely different words of wisdom whenever you launch it (the total number of permutations is 1,600).

4. WRITE YOUR OWN PROVERBS

Now for the creative part. You can overwrite the current proverb text or add more. Just follow these rules:

» 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?

image

Fig. B: Sample output from the Proverbs program.

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.

Charles Platt is a section editor for MAKE.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.100.42