Exploring Artificial Intelligence on Your IBM PC
About This Project
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.
Book Information
Title: Exploring Artificial Intelligence on Your IBM PC
Exploring Artificial Intelligence on Your IBM PC Author: Tim Hartnell
Tim Hartnell Publisher: Bantam Books
Bantam Books Copyright: 1986
1986 ISBN: 0553342878
All source code is provided for educational and historical preservation purposes.
Quick Start
Want to run the programs right away? We've included a ready-to-use runtime environment with PC-BASIC!
Step 1: Install PC-BASIC
Linux/macOS:
cd runtime/pc-basic ./install-pcbasic.sh
Windows:
cd runtime\pc-basic install-pcbasic.bat
Step 2: Run Programs
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 .
Project Structure
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)
- Simple expert system (creature identification) X-SPURT.BAS - Generic expert system framework
- Generic expert system framework CHIP-CHOICE.BAS - Microprocessor chip identification expert system
Chapter 13: Self-Learning Systems
SELFLEARN.BAS - Two-outcome self-learning system
- Two-outcome self-learning system MULTI-SELF-LEARN.BAS - Multiple-outcome self-learning system
Running the Programs
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!
Alternative Options
If you prefer other BASIC interpreters:
DOSBox + GW-BASIC : Authentic 1980s experience DOSBox: https://www.dosbox.com/ (GPL v2) GW-BASIC: Now open source! https://github.com/microsoft/GW-BASIC (MIT License)
QB64 : Modern BASIC compiler Website: https://qb64.com/ (MIT License) May require minor syntax adjustments
FreeBASIC : Native BASIC compiler Website: https://www.freebasic.net/ (GPL/LGPL) Supports QB-compatible syntax
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
About the Book
"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.
License and Usage
The source code is provided for educational and historical preservation purposes. Please respect the original copyright of the book and its contents.
Contributing
If you have corrections, improvements, or additional programs from the book, please feel free to contribute. When submitting changes:
Preserve the original code structure and style as much as possible Document any modifications for compatibility with modern systems Maintain the historical accuracy of the listings
Acknowledgments
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.