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 🙏

© 2025 – Pkg Stats / Ryan Hefner

aimjs

v1.0.34

Published

A js library for artificial intelligence creation

Readme

What is AIMjs ?

AIMjs is a javascript library designed to build AI using a standard tree of states system. Popular algorithms like breadth-first, depth-first or A* are implemented and easy to use. Take a look at our examples to discover the power of AIMjs.

Quickstart

  • First set up your project by including AIM.js, form this just run npm install --save aimjs and include it as any npm package var AIM = require('aimjs'). Set a public path to the module to use it client side app.use('/AIM', express.static(__dirname + '/node_modules/aimjs')) (or just move the file somewhere) and include it in your html page <script type='text/javascript' src='/AIM/AIM.min.js'></script>. A beautiful tree with all explored state can be a good way to find bugs or optimize a AI, to use this feature you need to include Treant.js, raphael.js and Treant.css.

  • Now you have to think about how to represents a state, AIMjs can't do this for you. In this example we will take a glass reversing game : there are 7 glasses, some of them are upside-down, our state will be an array of bits with 0 for an upside-down glass. So our initial state is [0, 1, 0, 0, 1, 0, 1] and our final state is [1, 1, 1, 1, 1, 1, 1].

  • Next step is to create a function getSuccessors(state) that return a array which contains all successors of the state passed as parameter. In our case we can reverse only two adjacent glass so we have 6 successors for each case (reverse glass 0 and 1, 1 and 2, ..., 5 and 6). The function is :

    var getSuccessors = function (state) {
      var successors = []
    
      for(var i = 0; i < state.length - 1; i++){
        var newState = AIM.clone(state);
    
        newState[i] = (newState[i] + 1) % 2
        newState[i + 1] = (newState[i + 1] + 1) % 2
        successors.push(newState)
      }
    
      return successors
    }
  • Now the hardest part is done we just have to instanciate and run the AI :

    var glassReverseAI = AIM.AI({
      initState: [0, 1, 0, 0, 1, 0, 1],
      finalState: [1, 1, 1, 1, 1, 1, 1],
      getSuccessors: getSuccessors
    })
    var result = glassReverseAI.execute('breadth-first')
    result.print()

There are multiples example, 8-puzzle is a perfect AI to understand how AIMjs work and how to use A* with a specified heuristic and draw a tree.