npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

go-life

v2.0.228

Published

Conway's Game of Life

Downloads

2

Readme

A complete implementation of Conway's Game of life (and derivative cellular automata) in the form of a JS library, web app, and console app.

I had fun building this for the last week or so. I don't know if I'll ever touch this again, but there's still a lot that could be improved upon. I've listed some potential to-do items for possible future version in the change log. If anyone is interested in contributing, be my guest.

Version 1 is still available in the Version 1 branch, if you're interested.

JS Library

I don't expect anyone is going to use this as a library, since it already comes with 2 working interfaces, but it's available to use if you so desire.

Installation

npm install go-life

Usage

GoL.js or GoL.min.js contain all the classes you need.

Create a renderer that extends the GoLRenderer class, or use the existing canvas renderer (GoLCanvasRenderer) or SVG renderer (GoLSVGRenderer), or even the GoLTerminalRenderer if you want to build a CLI. The renderers have a few otions, which you can check out in the parent class constructos, and all but the terminal renderer require an element (eg <canvas> or <svg> to render on.

Create an instance of the game with new GoL(renderer, options). See the constructor for available options.

If you want to use the built-in mouse control APIs, you can create a new instance of GoLMouse and pass the instance of the game to it.

Finally if you want to read and write RLE pattern files you will want to look at the GoLRLE class.

For examples, refer to the javascript for the included UI, assets/js/index.js.

Web App

You can play online without downloading anything right here.

Everything you need to know about how it works is explained in detail in the help section, so if you need help, click the help button or press CTRL + H.

Console App

The CLI only runs existing RLE files. You can provide a full file name to your own pattern files or you can use the name of a pattern file in the pattern library.

You can scroll through the pattern library with ./go-life ls.

You can then get info about any pattern file, including your own files, with ./go-life info filename.rle

To run the pattern file in the CLI, simply ./go-life filename.rle. See below for other options.

  • Run an RLE file ./go-life file [color [color [speed [runtime]]]]
  • Get info about an RLE file: ./go-life info file
  • List RLE files in the pattern library: ./go-life ls

Change Log

Credit

Pattern file source: conwaylife.com. Thanks a bunch.

License

Copyright 2018 Rob Parham

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.