Giter VIP home page Giter VIP logo

artificial-life-game's Introduction

artificial-life-game

Repository with console python implementation of Simple Artificial Life (simplified MAS) and Conway's game of life

Installation

conda create --name <env_name> --file requirements.txt
conda activate <env_name>

Conways Game of Life

See WIKI for detailes abot Conway's Life: https://conwaylife.com/wiki/Gosper_glider_gun 3 Initial State Animations implemented:
1 - Randomly turned cells
python conwayGameOfLife.py
2 - Glider
python conwayGameOfLife.py --grid-size 32 --interval 500 --glider
3 - Gosper
python conwayGameOfLife.py --interval 500 --gosper

Simple Life Realization

Details and Rules

Terms: Field, Cell, Agent

Artificial Life Example

Agent - acting model. Has Physical and Mental health.
Can make 3 actions: Move, Split, Eat

  • Each Move decrements Mental Health (by 1). Mental Health Is not renewable. Moves can be made on 4 directions: up, down, left, right.
  • Each Eat action increase Physical Health . (Eat till MAX_PHYSICAL_HEALTH reached). Per Game tick it 1 food form Cell.
  • Agent make Split when Physical Health > 0.8 * MAX_PHYSICAL_HEALTH (A MUST). It decrements Physical Health with value 0.8 * MAX_PHYSICAL_HEALTH . 0.8 is a split coefficient - can be controlled in ./helpers/consts.py

Cell - each cell of field. Has food generated randomly

  • Stores food value
  • Bordered with MAX FOOD value - can be controlled in ./helpers/consts.py
  • Color of Cell. If has food - 255 (yellow), of don't have - 0 (purple)

Field - 2dim Cells array

  • Should be renewable : per tick 2 foody cells creates randomly (this value can be changed)

Deafault sconditions

MAX_FOOD_IN_CELL = 5       	# Max food value in cell
FOOD_COLOR_MAP = {
    0: 0,
    1: 51,
    2: 102,
    3: 153,
    4: 204,
    5: 255
}							# Color gradient depends on food quantity in cell
INITIAL_AGENTS_COUNT = 1	# 1 agent creates when simulation starts
PART_OF_CELLS_WITH_FOOD = 0.1 * N * N   #  only 0.1 of total cells are with food initialt
INITIAL_AGENTS_COUNT = 1
MAX_MENTAL_HEALTH = 15
MAX_PHISICAL_HEALTH = 30
SPLIT_COEFFICIENT_PHISICAL = 0.8
DECREMENT_PHISICAL_HEALTH = 0.8 * MAX_PHISICAL_HEALTH   # when split
DECREMENT_MENTAL_HEALTH = 1     # when move
UPDATE_INTERVAL = 1000
MAX_AGENTS_COUNT = 8
MAX_DEAD_TICKS = 3 

artificial-life-game's People

Contributors

vplotnik avatar truecoder34 avatar

Stargazers

Biryukov Ilya avatar Valeriy Petrov avatar Kovalev Ivan avatar Adolf avatar  avatar Timofey avatar Klenov Matvey avatar

Watchers

James Cloos 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.