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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@letsandeepio/battleship

v1.0.1

Published

A simple battleship game written in Node.js

Readme

code coverage

Battleship

A Commandline game based on the popular board game written in Node.js

GamePlay Demo

battleship

Deployment

The game is currently published as Command Line Interface (CLI) Utility as an npm package and can be run directly by typing below on the command line (node < v10 & npm < v6 is required to be installed)

npx @letsandeepio/battleship

Technical Details

The app is built using Node.js. Individual components are implemented using classes, an efficient algorithm is used to check if the ship is placeable on the board or not. Also, the app makes use of the following NPM packages for a great UX experience:

  1. figlet for the retro game font at the beginning of the game
  2. chalk for colourful fonts
  3. prompts for interactive user input

The app is linted using eslint and uses jest for comprehensive mock game-play testing (current test coverage is 88%).

Salient Features

  • Interactive user input allowing to select from the list of options
  • Improved validation of user input without using loops and faster feedback to the user of invalid input.
  • Allow players to have names.
  • Print gameboard at every round.
  • Let the user know if they already hit a spot before.
  • Print victory message with a final view of the battlefield with the location of ships (boards of both player's)

Gameplay Features

  • Two Player game
  • Two boards (one for each player)
  • 1 Ship (length of 3) - can be placed vertical or horizontally (fully extensible to allow for more ships of various sizes)
  • Ask the location for placement of Ship for each player.
  • Fire a single shot per turn (Hit, Miss, or if the ship has been Sunk (3 hits) then register a “you sunk enemy battleship”)
  • game ends when one player sunk other player's ship

Installation

See the above “deployment” for running the game without needing to install it. In order to install a local version follow the below commands at the command line:

  1. git clone [email protected]:letsandeepio/battleship.git
  2. cd battleship
  3. npm install

Finally, run the the below from the root folder of the project to run the game:

  1. ./bin/battleship

Note: If you get permission error, please use following command to grant the relevant permissions: chmod +x bin/battleship

Testing

  • to start Jest in watch mode type npm test
  • to collect test coverage type npm test:coverage

Copyright

MIT License 2020, Sandeep Kumar Chopra