An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# string_weasels

[![Open in Codespaces](https://github.com/codespaces/badge.svg)](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.