This repository houses the source code for 'Fun Computer Science Projects in Python,' a book that guides Python developers through a variety of intriguing projects. With insights into interpreters, emulators, and computer art, it offers practical learning for those looking to enhance their programming skills.
This repository serves as the official source code for the book Fun Computer Science Projects in Python authored by David Kopec and published by No Starch Press. Targeted at intermediate to advanced Python programmers, the book features seven diverse projects that explore interpreters, emulators, computer art, and introductory machine learning concepts. These projects are designed to be compatible with Python version 3.12 and above.
Project Overview
Below is a comprehensive list of the seven projects included in the book along with a brief description of each:
Project | Chapter | Section | Description |
---|---|---|---|
Brainfuck | 1 | Interpreters | An interpreter for Brainfuck, one of the simplest programming languages. |
NanoBASIC | 2 | Interpreters | An interpreter for Nano BASIC, a simplified dialect of Tiny BASIC, which played a significant role during the personal computer revolution. |
RetroDither | 3 | Computer Art | A program that applies 1-bit Atkinson dithering to modern photos, converting them into black and white images for classic Mac display in MacPaint format. |
Impressionist | 4 | Computer Art | Utilizes a stochastic hill climbing algorithm to generate abstract art from photographs, resembling the style of impressionist painters. |
Chip8 | 5 | Emulators | An emulator for the CHIP-8 virtual machine, allowing users to play vintage games from the 1970s. |
NESEmulator | 6 | Emulators | A basic NES emulator that enables playing select public domain games but with limited features and capabilities. |
KNN | 7 & 8 | Super Simple Machine Learning | A drawing recognition tool that interprets user sketches of digits using K-nearest neighbors classification and can also complete them through regression. |
Running and Testing Projects
Each project can be executed as a module using the -m
option from the root directory. The code is validated against Python versions 3.12 and 3.13, and prior versions are not supported. Below is an example command structure for executing the projects:
python -m ProjectName <your_file_name>
Example command for the Brainfuck interpreter:
python -m Brainfuck Brainfuck/Examples/beer.bf
Type Hints
The repository fully utilizes the advanced type hinting features introduced in Python 3.12 and above. While the code may be run in earlier versions of Python by removing certain type hints, no support is provided for such modifications. All type hints were thoroughly verified using Pyright.
This repository offers a unique blend of programming exercises aiming to enhance coding skills and enrich understanding of Python programming through practical implementation.
No comments yet.
Sign in to be the first to comment.