Git Product home page Git Product logo

wa-tor's Introduction

Wa-Tor

Wa-Tor population dynamics simulation devised by A. K. Dewdney in a Scientific American article entitled "Computer Recreations: Sharks and fish wage an ecological war on the toroidal planet Wa-Tor" (December 1984).

Wa-Tor is implemented as a two-dimensional grid showing fish, sharks and empty water. Swimming past the edge of the grid results in the creature appearing on the opposite side. Sharks eat fish and may also starve. Sharks and fish move, reproduce and die according to simple rules. From these simple rules complex emergent behavior can arise. "Time passes in discrete jumps, which I shall call chronons. During each chronon a fish or shark may move north, east, south or west to an adjacent point, provided the point is not already occupied by a member of its own species. A random-number generator makes the actual choice. For a fish the choice is simple: select one unoccupied adjacent point at random and move there. If all four adjacent points are occupied, the fish does not move. Since hunting for fish takes priority over mere movement, the rules for a shark are more complicated: from the adjacent points occupied by fish, select one at random, move there and devour the fish. If no fish are in the neighborhood, the shark moves just as a fish does, avoiding its fellow sharks." (Dewdney, 1984).

For the fish

  1. At each chronon, a fish moves randomly to one of 4, adjacent unoccupied squares. If there are no unoccupied squares, no movement takes place.
  2. At each chronon, each fish ages. Once a fish's age exceeds a certain number of chronons (fish_breed parameter) it may reproduce. Reproducing is done by leaving behind a new fish as it moves to a new square. Both the original fish and new fish have their age reset to zero.

For the sharks

  1. At each chronon, a shark moves randomly to an adjacent square occupied by a fish. If there is none, the shark moves to a random adjacent unoccupied square. If there are no free squares, no movement takes place.
  2. At each chronon, each shark ages. Once a shark has survived a certain number of chronons (shark_breed parameter) it may reproduce in exactly the same way as the fish.
  3. If a shark moves to a square occupied by a fish, it eats the fish and a certain amount of energy. When this energy is depleted then the shark dies. This is implemented by resetting the time since a shark last ate to zero. When the time the shark last ate reaches a certain time (shark_starves parameter) then the shark dies.

What are the parameters for the longest running simulation you can find?

wa-tor's People

Contributors

nakzz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.