GithubHelp home page GithubHelp logo

roamers-in-the-wild's Introduction

Roamers in the Wild

This is a simulator of wildlife wandering in the world, trying to get some food and reproduce. Every game is different, as animals are assigned different genes (which determine the probability of moving in each direction) at the start of each game and plants are spawned in random spots. Basic statistics about time elapsed and population of animals and plants can also be found.

Rules of the simulation

  • At the beginning there is one animal with 1000 health (or energy) points
  • Each turn every animal which has above 200 HP reproduces, giving half of its energy away to the child (standard male-female reproduction to be implemented)
  • While reproducing, baby's genes have substantial chance to slightly differ from the adult's genes
  • Animals move once a turn in a direction determined by their genes. While moving, they lose one HP
  • Animals eat a plant once they find it, gaining 80 HP
  • Animals with 0 HP die
  • Stepping outside the map, the animal is moved at the other side of it, as if the map was folded
  • The map is a 100x30 rectangle, and in its middle there is a 10x10 square called jungle. Each turn there is 50% chance of spawning a plant inside a jungle and 100% chance of it outside the jungle. Plants grow more densely in the jungle anyway as it is substantially smaller than the area outside it.

Influencing the simulation

For now we do not have many tools to change the game course. We can use the input field at the bottom of the window (there exists a bug where it may appear only after resizing the window) to introduce some basic commands:

  • delay value - sets delay in milliseconds between days. Use delay 0 for maximum speed
  • restart - speaks for itself
  • retry - spawn a new animal with 1000 HP at a random spot. Helps animals to survive or to repopulate the map in a rare case where all animals die.

Changing default HP values for animals and plants or throwing meteors at the map yet to be implemented.

Created with

Tools

Language features

  • Lists, sets, maps and their ConcurrentModif... modification-safe methods
  • Nested classes
  • Cloneable interface
  • Some fancy randomness-related methods from RandomnessHandler class - my first wise use of static methods (except main) I can think about.
  • "Swing"

Possible improvements

  • Set of animals is OK in the case where animals don't need a partner to reproduce, so we iterate all over the set. When it comes to implementing true reproduction things get worse as we would have to iterate over the list twice or do some other things to find animals which are close to each other. Map<Position, List<Animal>> seems to be a better solution.
  • Animal class mixes usage of setters and direct assignments, which is to be cleaned up
  • Swing is never all right

roamers-in-the-wild's People

Contributors

jakubraban 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.