| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Wa-Tor simulates ecological cycles between fish and sharks on a water-covered toroidal planet. By setting up the number of fish and sharks, the breeding times of each, and the starvation time for sharks, the simulation progresses stepwise with fish randomly moving and reproducing, and sharks "hunting" or randomly moving around a wrapping grid representing Wa-Tor's toroidal surface.
I first saw Wa-Tor described in A.K. Dewdney's Computer Recreations article in the December 1984 issue of Scientific American and it was the first non-trivial program I ever wrote from specs on the Apple IIc computer I finally was able to buy a few months later with money I'd saved.
Both the disk with my original source (and the Apple IIc itself) are long gone, so I set out to recreate it for multiple reasons--one part nostalgia, one part in support of an ongoing writing project, and one part in support of a January 2018 tech talk.
Differences between this version and my original 80's version:
If you're interested, I've also put together a Rust-based WebAssembly version of Wa-Tor that runs in your browser and is quite a bit faster and more visually fun. (Or at least fast enough to be measured in frames-per-second instead of seconds-per-frame.)
You can run the code in your browser by loading or pasting the raw source into Joshua Bell's very cool Applesoft Basic in JavaScript emulator.
The current implementation runs through the JavaScript emulator at anywhere from about 8 to 12 seconds per frame (depending on the number of fish and sharks), which is about on par with what I recall for the original running on native Apple IIc hardware.
For best results when picking the parameters, you typically want to use something where fish breed faster than sharks, and sharks have to eat before they can spawn.
| Back | FazBrowse Home | New Git URL |