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

robotic-hoover

v0.0.1

Published

Robotic hoover implementation

Downloads

1

Readme

Robotic hoover

Helps navigate an imaginary robotic hoover through an equally imaginary room with dimensions as X and Y coordinates, identifying the top right corner of the room rectangle. This room is divided up in a grid based on these dimensions; a room that has dimensions X: 5 and Y: 5 has 5 columns and 5 rows, so 25 possible hoover positions. The bottom left corner is the point of origin for our coordinate system, so as the room contains all coordinates its bottom left corner is defined by X: 0 and Y: 0.

NB! The North direction is the same ordinate (y-axis) value increases, and East direction increases the abscissa (X-axis).

Usage

The hoover object can be instantiated given arguments object with properties defining:

  • room - dimensions
  • dirty - array of locations of patche of dirt, also defined by X and Y coordinates
  • location - initial hoover position (X and Y coordinates like patches of dirt)

Methods provided to interface with the hoover:

  • .move() - driving instructions (as cardinal directions where e.g. N and E mean "go north" and "go east" respectively)
  • .getLocation() - to find where the hoover is
  • .cleaned() - returns how many dirty patches have been cleaned to date.

Example

import {Hoover} from "robotic-hoover";

// Constructing a room and initial location:
const settings = {
  room: [5, 5],
  location: [1, 2],
  dirty: [[1, 1], [2, 2], [3, 3]]
};
const roover = new Hoover(settings);
roover.move("E");
rover.getLocation(); // returns [2,2] and one dirty patch cleaned
rover.cleaned(); // 1

Contributing

Just geting a copy of the repo and install the dependencies:

git clone https://github.com/laurinenas/robotic-hoover
cd robotic-hoover && npm i && npm t

There are hooks making sure that you can not commit breaking changes so you can start hacking with confidence.

⅓rd of this repo is just gherkin, I suggest before writing a line of code express it using BDD so you can get that shot of dopamine when tests gradually become pickle green.

If you spotted a mistake, a missed test case, or have suggestions: issues and PRs are very welcome. But most of all, there is no such thing as too much 🥒 gherkin.

What this lib is not

Finding the shortest path cleaning all dirty nodes is not in scope of this lib.

Neither is dealing with hoover or dirty patches hoover beyond of the room limits.