Giter Site home page Giter Site logo

go-game-of-life's Introduction

Build Status GoDoc Go Report Card codecov Maintainability HitCount

Conway's Game of Life

From Wikipedia, the free encyclopedia:

The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. The game is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves, or, for advanced players, by creating patterns with particular properties

screenshot This a go implementation of Conway's Game of Life. It allow to specify the size of the size of the starting grid, aswell as the precentage of living cells at the start. The grid is displayed using ascii.

The evolution of the cells follows this four simple rules:

  1. Any live cell with fewer than two live neighbors dies, as if by underpopulation.
  2. Any live cell with two or three live neighbors lives on to the next generation.
  3. Any live cell with more than three live neighbors dies, as if by overpopulation.
  4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

Install

Just get the source and build/install as normal

go get -u github.com/binaryplease/go-game-of-life
go install github.com/binaryplease/go-game-of-life

Usage

You can pass the following parameters to the executable, all of them are optional and will use a default, if ommitted.

usage: game-of-life [<flags>]

Flags:
      --help           Show context-sensitive help (also try --help-long and --help-man).
  -x, --xsize=80       The width of the grid
  -y, --ysize=15       The height of the grid
  -i, --iterations=-1  Number of iterations. Any negative number will use the default, infinity
  -f, --fps=25         Frames per second, how log to wait until the next iteration is displayed
  -p, --percentage=35  Percentage of living cells at the start
      --version        Show application version.

This Software

I implemented this as an excercise to explore go's testing package, travis-ci and some other of go's features. It probably has no real-world applications, but is nice to watch for a while.

You may fork, modify, copy, distribute, watch it for hours or do whatever you want with it. Have fun!

Contributing

Pull-requests, issues, comments and other improvements are very welcome!

go-game-of-life's People

Contributors

pinpox avatar u5surf 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.