Code Monkey home page Code Monkey logo

canvas_cellular_automata's Introduction

Cellular Automation Editor

pssst, its live here

Cellular automation is a fairly simple idea.
You start with an infinite grid, and every cell's state is determined by the cells around it.
There are a few types of "neighborhoods" or ways to count your neighbors. In this project, I use what is known as a Moore neighborhood. If you don't know what that means, think minesweeper, every cell just checks the 8 cells surrounding it.
Every cell's state is determined by the states of the cells' around them. So in the simplist example, conway's game of life, every cell can have 2 states, alive or dead. A dead cell becomes alive in the next step if it has 3 alive neighbors. An alive cell becomes dead if it has less than 2 or more than 3 alive neighbors.

My Project

My project allows you to edit the rules in a simple and easy to understand way.

Features

  • Full control of the simulation
    • pause
    • play
    • step
    • editing while paused
    • clearing
    • randomizing
    • changing size of the grid
    • changing the delay between steps
  • rule editor
    • adding rules
    • removing rules
    • editing rules
  • help page
    • simple explanation of what is going on
    • interactive demo

Technical Stuff

I used html5 canvas in this project to draw everything necessary. I didn't use any libraries.

Future Additions

I do plan to keep working on this project after the intensive and get people that are also interested in cellular automation to work with me to add features, that being said I do have a todo page with all of the current and future plans.

canvas_cellular_automata's People

Contributors

drakevorndran avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

canvas_cellular_automata's Issues

Why not const?

let changes = []

You're code looks great, I'm struggling to find areas to push you, that said, I doubt this is going to change, it should probably be const. There are a few more variables that I see should probably be consts also.

Great work!

This is pretty awesome, but it's not finished. Your readme is weak. Well nonexistent really. I asked for a mildly detailed readme. Described what you did with the API, provide some code samples, give some opinion, use a little formatting, provide an install usage guide.

Why not ry making a class...

boardO.init = function(height, width,size){

You're building objects with methods and defining a init method even. Might as well turn this into a class. This is sort of the same thing but with built in convention. It will also enforce good coding habits.

I am so not into...

<button onclick="boardO.make_glider()">glider</button>

... these js function calls in HTML attributes. To be honest I'm not really sure whether this is best practice or not, I suspect not. I suppose you might say it couples your implementation to your HTML structure. It's probably more flexible in the long term to use an id and add a listener. Which you are doing in other places, which makes this look inconsistent.

I'll leave it up to you, but I recommend against this.

Try let...

for(var i = 0; i<this.grid.length; i++){

Overall your code looks pretty advanced. Looks like you have a lot of experience with JS. It also look like you are coding without a lot of the new features. You should stretch yourself by trying to incorporate as many of the newer features s you can.

You probably wrote this for loop on automatic. But this var could be a let. I think this is best practice these days, and will be in the future.

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.