将 David Ahl 的《BASIC 计算机游戏》移植到 C 语言
David Ahl's Basic Computer Games Ported to C

原始链接: https://github.com/proteanthread/bcg

本仓库收录了 David Ahl 所著《BASIC 电脑游戏》和《更多 BASIC 电脑游戏》中的经典游戏,这些游戏已从原始的 GW-BASIC 格式移植为 C 语言版本。尽管代码旨在实现跨平台支持(涵盖 Linux (GCC)、Windows (MSVC) 和 FreeDOS (Open Watcom)),但目前项目仍处于开发阶段,尚未经过全面的测试、调试或验证。 该项目旨在作为协同学习工具;鼓励用户派生(fork)本仓库以协助调试或完善代码。源代码位于 `src/` 目录下,同时保留了原始的 `.bas` 文件以供参考。每个 C 语言文件中也包含了注释形式的原始 BASIC 代码,以便于比对。根目录下提供了适用于所有支持环境的构建脚本。本项目为开源项目,采用 MIT 许可证。

最近一篇 Hacker News 的文章介绍了一个 GitHub 上的新项目,该项目将 David Ahl 的经典著作《BASIC 电脑游戏》(BASIC Computer Games)移植到了 C 语言中。Ahl 的这本书出版于 1973 年,早于许多现代 BASIC 方言和微型计算机的出现,是早期计算机爱好者手动将代码输入 PDP-11、TRS-80 或 Apple II 等系统时的基础教材。 讨论中反映了该书的历史意义,用户们回忆起当年为适配不同平台而手动调整代码的艰辛。尽管评论者指出人工智能现在可以轻松自动完成此类移植,但他们强调这些练习的价值在于手动过程本身以及对历史的保护。一些用户建议,这些游戏是进行“文学编程”(Literate Programming)文档记录的理想素材。该讨论帖还将此项目与 Jeff Atwood 在《Coding Horror》中发起的将该合集翻译成多种现代编程语言的努力进行了比较。
相关文章

原文

These haven't been tested, validated, debugged, or verified!

  • Yes, I used Google Anti-Gravity to convert the programs from GW-BASIC to 'C', but what a better learning tool than to debug a program?

  • This repository contains a 'C' port of the classic GW-BASIC games from David Ahl's "BASIC Computer Games" and "More BASIC Computer Games" originally published by Creative Computing.

  • The original games were written in GW-BASIC and have been ported over to 'C', ensuring they compile and run on a variety of platforms including Linux (GCC), Windows (MSVC), and FreeDOS (Open Watcom).

  • When I get time, I will finish this project, otherwise fork it and finish it yourself.

  • Make sure CAPS LOCK IS ON!

The repository includes build scripts for multiple environments:

  • Linux (GCC): Run ./build_lx.sh
  • Windows 11 (MSVC): Run build_win.bat
  • FreeDOS (Watcom): Run build_fd.bat

The source files for the C ports are located in the src/ directory. The original GW-BASIC code is retained in the .bas files in the root directory and as comments directly inside the ported .c source files for easy reference.

This project is licensed under the MIT License - see the LICENSE file for details.

联系我们 contact @ memedata.com