Giter VIP home page Giter VIP logo

ants_simulation's Introduction

 ___________________
/\                  \
\_| ants_simulation |
  |   ______________|_
   \_/________________/


Requires my_js_lib https://github.com/andreasjansson/my_js_lib

A naive Javascript ant colony simulation. Nothing half as complex as
actual Ant Colony Optimisation
(http://irancic.buksna.net/metah/0262042193.pdf), but it's pretty to
look at.

The ants form a subsumption architecture by having a number of
reactive rules govern their behaviour. The rules are ordered by
precedence, and once a rule has applied, no other rules can apply (a
bit like [L] in Apache configurations). These are the rules (ordered by
precedence, descending):

1. If you carry food and you are at the ant hill: Drop the food and
   get a new, random, direction of movement.

2. If you carry food and you are next to the ant hill: Drop pheromone
   and set direction on the ant hill.

3. If you carry food and you are standing on pheromone: Drop pheromone
   and set direction on the pheromone in front of you (if any).

4. If you carry food: Set direction on the ant hill and drop pheromone.

5. If you have found food: Pick up the food, drop pheromone, and set
   direction on the ant hill.

6. If you are standing on pheromone: Set direction on the pheromone in
   front of you (if any).

7. Sense distant pheromone, and if you sense any, set direction on it.

Ants don't always follow the rules regarding their movement, sometimes
they just walk randomly.

Configuration parameters can be found in the Config.js file.

Note: In the stylesheet you need to make all child divs of the View
node absolutely positioned. Otherwise nothing will work.

This simulation can (soon, if not already) be viewed at
http://subsumption.jansson.me.uk

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.