Git Product home page Git Product logo

game-of-life's Introduction

gameoflife

University of New Orleans Software Design I Homework Five – Game of Life

Briefly, John Conway's Game of Life is a game of cellular automata. The game consists of a grid ofsquares that are either on or off. At each time step, each cell is evaluated and is either turned on or off based on the evaluation of 4 rules. The four rules are as follows:

  • Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  • Any live cell with two or three live neighbours lives on to the next generation.
  • Any live cell with more than three live neighbours dies, as if by overcrowding.
  • Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

At each step in the game, every cell is evaluated against these four rules to determine if it will be on or off for the next step of the game.

The program will accept as a command line argument a string that holds the name of an input file. It will read from the input file the size of the grid and the starting values for all of the squares.

After initializing the board, it will display it then apply the rules to determine the state of the next step. Then display it, and apply the rules again. Then display it, and apply the rules again. And again. And again…

The edges the grid wrap, that is: cells on an edge of the board can feel the opposite edge of the grid. For example, if a cell on the right edge of the board is on, its neighbours include cells on the left edge. This will allow shapes that are moving across the grid to pass through one edge and come out on the other side.

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.