made a game of life because i can't stop myself from writing code?

Overview

🪸 Life

I was reading something today that mentioned Conway's Game of Life. I remember making a rudimentary version for my terminal with Python when I was first learning to program. So, instead of finishing what I was reading, I made this one that runs in my browser. That was fun! I guess it's time to go back to whatever it was I was reading. Even though I now just want to optimize and add features to this new rudimentary version. xD

— Jason (Sat, Oct 1, 2022)

Notes

Usage

  • To use, download this repo and open up index.html in your browser.
  • You'll need an internet connection as this pulls in lodash from a CDN
    • Removing it and making a shallow copy might be fine...I think i've done well not to mutate the objects or rely on nonmutated values.
  • Reload the browser tab to start again.
  • Some mildly intesting logs will show up in the browser console.
  • Edit some of 'config' and 'initial state' vars in script.js to change things up.

Details

  • Currently we set up by making a bunch of divs and colouring them.
  • Painting is done by computing the next state (a 2D array of 0s or 1s), running through each value, and setting the corresponding colour into the DOM node. We skip when there's no change to avoid unecessary writes to the DOM...
  • This is called in a setInterval with a limit that we set just to be really really nice to our computer. But I guess it wouldn't be the worst thing to just run it forever.
  • We also do a simple diff of the current and next state to tell if the image is still and end the loop early.
You might also like...

One-stop Go+ programming language environment manager

One-stop Go+ programming language environment manager

InGop (Go+ language) One-stop Go+ programming language environment manager How do I learn the Go+ programming language quickly? Start with installatio

Nov 21, 2022

Run a command, watch the filesystem, stop the process on file change and then run the command again...

hubmon Run a command, watch the filesystem, stop the process on file change and then run the command again... Install You can install this command lin

Jul 30, 2022

radiQL, your one-stop-shop for migrating from a legacy REST backend to an efficient and modern GraphQL API

radiQL, your one-stop-shop for migrating from a legacy REST backend to an efficient and modern GraphQL API

Welcome to radiQL, the one-stop solution for setting up GraphQL on a PostgreSQL database. Check out our Medium article here. At A Glance: Give us your

Nov 14, 2022

Stop nsfw . Get Motivated

Stop nsfw . Get Motivated

Vergil Stop nsfw . Get Motivated This is a chrome extension which basically blocks almost all nsfw sites and redirects them to I AM THE STORM THAT IS

Dec 28, 2022

A one-stop app to manage and organize your daily reading habits!

A one-stop app to manage and organize your daily reading habits!

Reading Tracker with Local Authorization This is a place where you can write down all the books you plan to read, are currently reading, have finished

Sep 9, 2022

A Node.js HTTP proxy that tracks managed PaaS account applications and auto-stop&start them

A Node.js HTTP proxy that tracks managed PaaS account applications and auto-stop&start them

paastis-engine Features Paastis engine is the heart of the Paastis project. Its goal is to monitor and manage (start & stop) PaaS applications based o

Nov 8, 2022

A kickstarter guide to writing ES6

A kickstarter guide to writing ES6

ES6 for Humans 📢 The complete guide is now available on Amazon Table of Contents let, const and block scoping Arrow Functions Default Function Parame

Jan 4, 2023

This Plugin adds shortcodes with various prewritten phrases to improve quality and productivity of your writing.

Obsidian Phrasebank This Plugin adds shortcodes with various prewritten phrases to improve quality and productivity of your writing. Example :intro_pr

Jan 1, 2023

An ESLint plugin for writing Remix.js Apps

eslint-plugin-remix An ESLint plugin for Remix Installing Firstly, install the dependency with Yarn yarn add eslint-plugin-remix --dev or with npm npm

Nov 15, 2022
Owner
Jason Florentino
Software engineer on the web. Self-taught programmer. Used to make ads.
Jason Florentino
Stop re-writing thirdweb snippets. Use thirdsnips to make it all snap!

?? thirdsnips Stop re-writing thirdweb snippets. Use thirdsnips to make it all snap! Thirdsnips is a tool which enhances the developer experience whil

Avneesh Agarwal 24 Dec 14, 2022
Strcmp-node - A cli string comparison tool, because apparently one doesn't exist.

strcmp-node I couldn't find a string comparison command, so i made my own. its probably the ugliest thing since godzilla with makeup on, but it works.

Gingka/Ginger Pepper 1 Jan 1, 2022
Solidity starter combining foundry and hardhat because both are great and I can't live without either...

Combination Pizza Hut & Taco Bell Foundry && HardHat starter template. Motivation I like them both. With this set-up we get: Unit tests written in sol

Cache Monet 32 Aug 23, 2022
An easy to implement marquee JQuery plugin with pause on hover support. I know its easy because even I can use it.

Simple-Marquee Copyright (C) 2016 Fabian Valle An easy to implement marquee plugin. I know its easy because even I can use it. Forked from: https://gi

null 16 Aug 29, 2022
lifeRestart 游戏魔改之码农搬砖https://juejin.cn/game/coding-life?utm_source=github

Forked from https://github.com/VickScarlet/lifeRestart lifeRestart English | 简体中文 Introduction Game Life Restart Usage Web Version Clone project code.

稀土 52 Nov 20, 2022
The leaderboard web app displays the top scoring player on the fictional game of life.

Leaderboard is website that displays the scores submitted by all players. It also allows the current user to submit his/her score. All data is preserved thanks to the external Leaderboard API service.

Soufiane Boursen 13 Nov 23, 2022
Transpile TypeScript to Espruino flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable, and testable code is the projects goal.

ESP-TypeScript Transpile TypeScript to Espruino flavor of JavaScript for ESP8266/ESP32 microcontrollers template project. Writing safe, maintainable,

Spencer Kittleson 152 Dec 20, 2022
A JavaScript module that shortens your code, makes life easier, and makes development faster!

Quxt A JavaScript module that shortens your code, makes life easier, and makes development faster! Installation npm install quxt Quick Start Check ind

Qux App 5 May 8, 2022
🌹 Your one stop place for moderation and more.

Azalea Azalea is a advanced moderation bot used. This repo includes, the discord bot: Moderation, server stats, welcome & leave, reaction roles, auto

Saige 2 Sep 13, 2022
Dev Care - One stop solution to take care of your health as developers

Dev Care: One stop solution to take care of your health as developers ??‍?? One-stop solution to take care of your health as developers. Dev Care will

null 44 Dec 13, 2022