Show HN: I extracted BASIC listings for Tim Hartnell's 1986 book

1 month ago 1

This repository preserves and provides editable electronic copies of the BASIC source code listings from the book "Exploring Artificial Intelligence on Your IBM PC" by Tim Hartnell.

  • Title: Exploring Artificial Intelligence on Your IBM PC
  • Author: Tim Hartnell
  • Publisher: Bantam Books
  • Copyright: 1986
  • ISBN: 0553342878

All source code is provided for educational and historical preservation purposes.

Want to run the programs right away? We've included a ready-to-use runtime environment with PC-BASIC!

Linux/macOS:

cd runtime/pc-basic ./install-pcbasic.sh

Windows:

cd runtime\pc-basic install-pcbasic.bat

Linux/macOS:

cd runtime/launchers ./run-program.sh

Windows:

cd runtime\launchers run-program.bat

The launcher will present an interactive menu where you can select which program to run!

For detailed information about the runtime environment, see runtime/README.md.

hartnell-exploring-ai-book/ ├── source/ # BASIC program listings organized by chapter │ ├── chapter-02/ # Tic-Tac-Toe learning program │ ├── chapter-03/ # Syllogistic reasoning │ ├── chapter-04/ # Pattern matching (Snickers) │ ├── chapter-07/ # BLOCKWORLD natural language │ ├── chapter-08/ # DOCTOR (ELIZA-type chatbot) │ ├── chapter-09/ # Language translation │ ├── chapter-10/ # HANSHAN poetry generator │ ├── chapter-12/ # Expert systems (SPURT, X-SPURT, CHIP-CHOICE) │ └── chapter-13/ # Self-learning systems ├── runtime/ # PC-BASIC runtime environment │ ├── pc-basic/ # PC-BASIC installation scripts │ └── launchers/ # Program launcher scripts └── context/ # Additional context files

Program Listings by Chapter

Chapter 2: Learning from Experience

  • TICTAC.BAS - Tic-Tac-Toe game with learning capability

Chapter 3: Syllogistic Reasoning

  • SYLLOGY.BAS - Syllogistic logic processor

Chapter 4: Pattern Matching

  • SNICKERS.BAS - Pattern matching demonstration

Chapter 7: Natural Language Processing

  • BLOCKWORLD.BAS - Natural language interface for block world

Chapter 8: Conversation Programs

  • DOCTOR.BAS - ELIZA-style conversation program

Chapter 9: Language Translation

  • TRANSLATE.BAS - Simple language translation system

Chapter 10: Creative Programs

  • HANSHAN.BAS - Chinese poetry generator

Chapter 12: Expert Systems

  • SPURT.BAS - Simple expert system (creature identification)
  • X-SPURT.BAS - Generic expert system framework
  • CHIP-CHOICE.BAS - Microprocessor chip identification expert system

Chapter 13: Self-Learning Systems

  • SELFLEARN.BAS - Two-outcome self-learning system
  • MULTI-SELF-LEARN.BAS - Multiple-outcome self-learning system

These programs were written for IBM BASICA/GW-BASIC (circa 1984) and feature:

  • IBM PC-specific commands: COLOR, SOUND, KEY OFF, WIDTH
  • 40-column display mode support
  • Line-numbered BASIC syntax

Recommended: Use the Included Runtime

This project includes PC-BASIC, a free, open-source interpreter with bug-for-bug GW-BASIC compatibility. See the Quick Start section above for easy setup!

If you prefer other BASIC interpreters:

Running Directly with PC-BASIC

# If you installed PC-BASIC pcbasic source/chapter-08/DOCTOR.BAS # Or use Python module python3 -m pcbasic source/chapter-08/DOCTOR.BAS

"Exploring Artificial Intelligence on Your IBM PC" introduces fundamental AI concepts through practical BASIC programming examples. Topics covered include:

  • Machine learning and pattern recognition
  • Expert systems and knowledge representation
  • Natural language processing
  • Self-learning algorithms
  • Logic and reasoning systems
  • Creative programming (poetry generation)

The book was written during the early days of personal computing and represents an important historical snapshot of accessible AI programming education.

The source code is provided for educational and historical preservation purposes. Please respect the original copyright of the book and its contents.

If you have corrections, improvements, or additional programs from the book, please feel free to contribute. When submitting changes:

  1. Preserve the original code structure and style as much as possible
  2. Document any modifications for compatibility with modern systems
  3. Maintain the historical accuracy of the listings

Special thanks to Tim Hartnell for writing this foundational text on AI programming, and to all those working to preserve vintage computing knowledge and software.

Read Entire Article