https://github.com/bcorfman/string_weasels
How random mutation and natural selection can produce complex specified information
https://github.com/bcorfman/string_weasels
evolution github-codespaces information mutation pytest python tdd-python test-driven-development uv
Last synced: 24 days ago
JSON representation
How random mutation and natural selection can produce complex specified information
- Host: GitHub
- URL: https://github.com/bcorfman/string_weasels
- Owner: bcorfman
- License: mit
- Created: 2020-05-16T15:24:12.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2026-02-21T18:46:55.000Z (5 months ago)
- Last Synced: 2026-02-21T21:52:27.310Z (5 months ago)
- Topics: evolution, github-codespaces, information, mutation, pytest, python, tdd-python, test-driven-development, uv
- Language: Python
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# string_weasels
[](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=264466159&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=EastUs)
Python version of Richard Dawkins' Weasel program
I wrote this after reading Dudley Chapman's blog post on [Shakespeare, Evolution, and Weasels](https://theappleandthefinch.com/2016/04/30/shakespeare-evolution-and-weasels/). It was some good practice with Test-Driven Development (TDD).
My daughter is also learning about genetics in her 7th grade science class, so I thought this might interest her also. (It did. She was startled both at the results and that I built it in an hour and a half.)
To run, you'll need to either
* Click the *Open in GitHub Codespaces* badge at the top of this README
OR
1) Install [Python](https://www.python.org) 3.9 or higher.
2) Clone this repo.
3) Run `make devinstall` from the project folder to install development dependencies.
4) Run `make run` to execute the program and find the target string.
To run tests:
1) Install dependencies with `make devinstall`.
2) Run `make test`.
For non-development installs, run `make install`.
In typical runs, the program converges on "Methinks it is like a weasel." in roughly 30-60 generations, which compares well with Dudley's program.