Exemplo n.º 1
0
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version. This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.

* You should have received a copy of the GNU General Public License along with
This program. If not, see http://www.gnu.org/licenses/.

"""
import simulation


def header():
    print "--------------------------------------------------"
    print "       -- ARTIFICIAL BEES SIMIULATION --          "
    print "                                                  "
    print "   Author : tharindra galahena (inf0_warri0r)     "
    print "   Blog   : http://www.inf0warri0r.blogspot.com   "
    print "--------------------------------------------------"
    print ""


if __name__ == '__main__':

    header()
    w = simulation.world(40, 80, 600, 600, 600)
    w.set_bees((3, 9, 2, 10), (1, 1, 2, 0), 90, 2)
    w.simulate()
Exemplo n.º 2
0
# grid_model.py
# procedurally generates:
# - a grid-based landscape
# - organisms
# simulates ecology

import simulation

# world generation
world = simulation.world()
world.new_grid()
world.smooth()
world.elevation()

# species generation
all_species = []
all_species.append(simulation.species(elev_min=1, elev_max=2, elev_effect=2, fecundity=50, dispersal=1))
all_species.append(simulation.species(elev_min=2, elev_max=4, elev_effect=1, fecundity=25, dispersal=1))

# initialization
for species in all_species:
    species.scatter()

# ecological simulation
for tick in range(simulation.ticks):
    for species in all_species:
        species.environmental_death(elevation_map=world.elevation_map)
    simulation.competition(all_species=all_species, pop_cap=simulation.pop_cap)
    for species in all_species:
        species.reproduce()