GithubHelp home page GithubHelp logo

game-of-life's Introduction

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

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.

About implementation

This is a implementation of Conway's life game written on go.
For graphical implementation, the ebiten 2d engine was used.

Usage

The implementation has the following modes.

  1. Random fill mode
  2. Drawing mode
  3. Mode of ready-made figures

Random fill mode

In this mode, the first generation of cells is randomly generated.

Usage:

Random mode can be started by pressing the key (G).
Then press the key Enter to start the game.

Random fill mode

Drawing mode

Drawing mode will allow you to experiment by creating new shapes with the mouse

Usage:

Press the key ESC for stopping the game.
Then you can draw the shape with the LCM(left click mouse).
For the eraser, hold the Lshift(left shift) and use the left mouse button to delete the cells.

Drawing mode

Mode of ready-made figures

The ready-made shapes' mode allows you to use ready-made shapes from this list.
The list will be updated.

  1. Glider

Usage:

Press the number of the shape you want to use.
The shape will be drawn on the screen.
And for rotate the shape, press the RCM(right click mouse).

Drawing mode

other tips for managing the game can be found in the upper left corner

Install

To quickly start the game, use this command.

go run -tags=example github.com/fr13n8/game-of-life@latest

game-of-life's People

Contributors

fr13n8 avatar

Stargazers

 avatar  avatar

Watchers

 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.