Giter Site home page Giter Site logo

marianpekar / game-of-life-threejs Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 4.0 425 KB

Real-time configurable 3D implementation of Conway's Game of Life written in JavaScript using Three.js

Home Page: https://marianpekar.github.io/game-of-life-threejs/

HTML 1.62% JavaScript 98.12% CSS 0.26%
threejs conways-game-of-life math javascript 3d simulation

game-of-life-threejs's Introduction

Conway's Game of Life 3D

A 3D implementation of Conway's Game of Life written in JavaScript using Three.js and dat-gui.

It's configurable with a real-time response! (Yes, you can change rules while the simulation is running)

Give it a try ๐Ÿš€ https://marianpekar.github.io/game-of-life-threejs/

Conway's Game of Life 3D

GUI Manual

In the top-right corner is a beautiful dat-gui (some people say it's ugly, I disagree with that) with contains these folders: Cursor, World, Cells Appearance (folded), Simulation, and Rules. Let's take a closer look at them.

Cursor

Here you can set XYZ position of the cursor (red half-transparent cube initially in the middle of the world) and toggle selected cell between dead and alive state.

You can also use the Randomize NBRs feature, to randomly switch states of 26 cells that surround the cursor with Probability you can set above the Randomize button.

World

Here you can Clear the world (kill all cells), toggle visibility of world border lines and Save As.../Open... world state.

Cells Appearance

It's initially folded. When you unfold it, you can switch cells material between Normal and Phong material (Show Normal checkbox), set it's Opacity and Color (the color is, of course, see only when Show Normal is off).

Simulation

Here comes the fun part! This allows you to Run the simulation with the given Speed (1 = one step per second) or you can step manually with the Step button.

Rules

And last but not least, the rules! But don't worry, these rules are not here to bother you, in fact, you can have a lot of fun with them!

  • Any live cell with a count of neighbors <= Underpopulation dies.
  • Any live cell with a count of neighbors >= Overpopulation dies.
  • Any dead cell with a count of neighbors == Ideal becomes a live cell.

If this sounds cryptic for you, check out the links below, the whole thing is actually very simple, yet so beautiful!

Learn about Conway's Game of Life

Keyboard & Mouse Controlls

You can use a mouse to move around and keyboard to perform some actions too.

Mouse

  • LMB + Move โ€“โ  rotate view
  • MMB + Move or Scroll โ€“โ  zoom in/out
  • RMB + Move โ€“โ  move on a horizontal plane

Keyboard

  • Enter โ€“ next step
  • W, S, A, D โ€“ move cursor forward, backward, left, and right respectively
  • Q, E โ€“ move cursor up and down respectively
  • R โ€“ move cursor to the center of the world
  • Space โ€“ toggle cell state at the position of cursor
  • Delete โ€“ clear the world
  • V โ€“ toggle cursor visibility
  • G - toggle GUI visibility

game-of-life-threejs's People

Contributors

marianpekar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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