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

cursedlife

v2.0.0

Published

An implementation of Conway's Game of Life using NodeJS and NCurses.

Downloads

8

Readme

CursedLife

NPM version Build Status Dependency Status

An implementation of Conway's Game of Life using NodeJS and ~~NCurses~~ Blessed.

"But Paul, why build yet another Game of Life simulator for NodeJS?" Haha! The answer is simple, my friends:

  • I wanted to.
  • Mine is different.
  • The others I found were slightly confusing, and didn't allow custom rulesets.

Since version 2.0, this project uses the blessed library in place of node-ncurses. The node-ncurses project wasn't being actively supported, and didn't work on newer versions of Node (eg. 0.12) for a long time. Blessed is slightly less performant, but has much better compatability than the node-curses project ever had. Unfortunately there is already a Game of Life simulator written in blessed, so I lose a little bit of uniqueness. However, I think that I've done enough differently in this project that it's still worthwhile even after the switch.

Install

$ npm install -g cursedlife

Usage

Simply run the program from command line:

$ cursedlife

Commands

Once it's running, the program can accept several commands to control the simulation:

  • start : Will unpause the simulation
  • stop : Will pause the simulation
  • next : Will advance the simulation by one generation
  • clear : Will clear the entire screen, turning all cells off.
  • load : Will allow you to load a JSON configuration file.
  • set : Will allow you to set the speed, survivalrate, etc.

Simply start typing; the text will appear in the input panel along the bottom of the window. Hit 'ENTER' to submit your command.

Cursor

Use the arrow keys to move the cursor in the output panel. Hitting 'ENTER' will toggle the currently selected cell.

Loading Files

load <filename>; eg. load patterns/gospergun.json

The load command looks for files in the directory that the program was executed from. For example, if you cd to a directory full of JSON files before running $ cursedlife, all of those files will be accessible to the program without having to type the full path.

The files should be JSON, and should follow the this template:

{
    "posChar": "@",
    "negChar": " ",
    "birthrate": 3,
    "surviverate: 23,
    "state": [
        [false, false, false, false],
        [false, false, true,  true ],
        [false, false, true,  true ]
    ]
}

Note that all of the values are optional; you can have a JSON file that specifies only state, birthrate and surviverate, or any other combinations.

Release History

v2.0.0

Re-wrote the UI fully to use blessed in place of node-ncurses.

v1.0.0

Implemented a clear command. Also implemented the ability to move a cursor using the arrow keys, and toggle a specific cell using the ENTER key.

Bumped the major version number; these are all of the originally planned features, so I'm calling it the 1.0 release!

v0.0.4

The load command is now able to read other configuration options. For example, you can specify birthrate, surviverate and negative/positive characters in the JSON.

v0.0.3

Partially implemented the load command.

Loading JSON files from a patterns directory works. Currently, only simulation state is read from the JSON. The ability to read other configuration data from the JSON is planned.

Example:

  • load patterns/gospergun.json

v0.0.2

Implemented the set command for all variables that can be user defined.

Surviverate and birthrate are sets of integers from 0-8. A surviverate of 23 indicates that a cell will survive if it has either 2 or 3 active neighbours. Interval is the time, in ms, between each generation. Examples:

  • set surviverate 246
  • set birthrate 35
  • set generation 0
  • set interval 1000
  • set posChar @
  • set negChar .

v0.0.1

First working release. Many things are not implemented, but the following should work:

  • start
  • stop
  • next

License

Copyright (c) 2014 Paul McMonagle. Licensed under the MIT license.