Code Monkey home page Code Monkey logo

conways-game-of-life's Introduction

Conway's Game of Life with pygame/Python

"Marketing" Page

Conway's Game of Life is a simulation of what happens when a certain cell:

  • is overpopulated
  • is underpopulated
  • is dead
  • is revived/reproduced

Several interesting variations can take place, some making large stable structures, some that slowly decay, some that continuously transform. All of this based on simple rules that each cell must obey


As cells age, their color changes subtly. However, at various life stages, their color changes drastically. This is meant to mimic human life and it's various stages.

  • Youth: green
  • Prime: red
  • Middle Age: deep blue
  • Old Age: bright blue

When a cell reaches a certain age, it dies and a new cell is immediately born in its place, continuing the circle of life.


Geek Stuff

Draw circle method (and accessing grid squares)

  • each grid square has a method to draw a circle in it
  • square can be accessed directly (grids[0][0]) to get the first square, then it's arranged by column, so grids[0][1] would be the square under the first one
  • squares can also be accessed by coordinates (preferred) to get a particular grid square in the array
    • note: lookup is using math and subscripting to find the square rather than searching the array for a square between those coordinates
    • note**: coordinate lookup is preferred not for speed (since it's a moot point) but for scalability - if the user changes the number of cells, we want their current cells to appear in the same coordinate space
Reference/Unused
animation x value wrap around - x is an iterator
     x = cell_size.width//2
     if x >= board_size.width:
         x = cell_size.width//2
     else:
         x += cell_size.width

conways-game-of-life's People

Contributors

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