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

simple-automata

v0.0.5

Published

A JS/HTML/Canvas implementation of simple Cellular Automata.

Downloads

1

Readme

Simple Automata

Simple Automata is a library for creating simple cellular automata anywhere you can run JavaScript. It supports a two dimensional environment where each block (or "cell") is an automata. Going from top to bottom, each row is generated based on the state of the previous row. Using this library, you have a choice of 256 different rules and various starting conditions.

Installation

This library should run anywhere you can run JavaScript. More specifically, if you can use a JS Canvas, you can use this library. You can imbed it directly in a page or install it via NPM.

Direct Injection (CDN)

<script src = "https://cdn.jsdelivr.net/npm/simple-automata@latest/dist/cdn/index.js"/>

NPM

npm install --save simple-automata

Usage

To create an automata, just specify the id of the element you want it to appear in, the type of start condition, the rule you want to use, and any necessary options. Note: an instance of the Automata class will fill to fit the size of its container. Therefore, you should style the container's CSS appropriately.

// in an NPM environment ...
import Automata from 'simple-automata';

// ... then when you have it available

let auto = new Automata(
    my_container_id, 
    rule_type, 
    rule_num,
    options
)

Options

As stated above, the Automata class gives you many options. The most important ones have to do with the starting condition. All options objects require a height and a width, like so.

let auto = new Automata(
    'test-id', 
    'simple', 
    30, 
    {
        width: 50,
        height: 50,
})

However, if you decide to live on the wild side and opt for a 'random' starting condition, like so, you have to include a density property in your options object.

let auto = new Automata(
    'test-id', 
    'random', 
    30, 
    {
        width: 50,
        height: 50,
        density: 0.5,
})