GithubHelp home page GithubHelp logo

bshapka / life-in-java Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 42 KB

A Java implementation of Conway's Game of Life

License: GNU Affero General Public License v3.0

Java 100.00%
java java-14 conways-game-of-life

life-in-java's Introduction

Life in Java

This project is an implementation of Conway's Game of Life (or Life for short) in Java.

About Life

For information about the game, see About Life. For information about the creator of the game, see About John Conway.

Running the Project

The following is a set of recommended directions for running the project. Note that these directions assume a JRE exists and that it has been associated with the shell command java. The project was developed and tested with the Java 16.0.1 SDK and language level set to 14. Compatibility with older JREs may exist but is not guaranteed.

  • Download the supplied jar file from Releases
  • Start a shell session and navigate to the directory containing the downloaded jar file
  • Run the command java -jar life-in-java.jar to start the application (assuming the jar file was not renamed)

Note that if you download the source code and attempt to run the project, you will need to add JUnit 5.4 to the classpath.

Implementation Details

This section assumes basic familiarity with Life. If you are not familiar with Life but want to read this section, please read the section About Life, or consult a source like Wikipedia on the game.

All source files are well-documented, so explanations of or details about these files will not be supplied here.

Common implementations of Life represent the state of a world as a 2D list of bits or booleans. Typically a live cell is truthy while a dead cell is falsy. While this approach is intuitive, dead calls don't need to be stored, and doing so can have notable costs in terms of memory usage.

An alternative approach is to store only the coordinates of live cells, requiring significantly less memory. By representing coordinates as tuples and storing them in a set, further efficiencies are gained via hashing.

This implementation uses a toroidal grid. As such, objects that leave the screen on one edge will re-enter the screen with the same trajectory and velocity at the equivalent location on the opposing edge.

life-in-java's People

Contributors

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