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

battleshipjs

v1.0.4

Published

A Battleship CLI game with customizations

Downloads

9

Readme

Battleship.js

NPM

Sonarcloud Status Renovate contributions welcome semistandard ECMAScript license

A Battleship CLI game with customizations.

Features

  • Set the number of each 5 ship type.
  • Set the number of rows and columns in the board.
  • Play against computer or against another player in hotseat mode.
  • Choose which player plays first.
  • Choose whether to end attack turn even if player hits.
  • Set names of players.
  • Also randomly place your ships and attack opponent's ships.

Board

  • Empty: O
  • Boat (1 space): B
  • Frigate (2 spaces): F
  • Destroyer (3 spaces): D
  • Cruiser (4 spaces): C
  • Aircraft carrier (5 spaces): A
  • Miss: X
  • Hit: *

Installation

$ npm install battleshipjs

Usage

Flag | Short | Description | Usage -----|-------|---------|------ --rows | -r | Set number of rows in the board | -r 15 --cols | -c | Set number of cols in the board | -c 20 --multiplayer | -m | Play against another player | -m --swap | -s | Swap player turns (Player2 plays first) | -s --end | -e | End attack turn even if player hits | -e --first | -f | Set name of first player | -f berk --second | -n | Set name of second player | -n erol

Examples

Example | Description --------|------------ $ battleship | Starts a new game with default settings $ battleship -r 15 | Starts a new game with 15 rows $ battleship -c 20 | Starts a new game with 20 cols $ battleship -r 15 -c 20 | Starts a new game with 15 rows and 20 cols $ battleship -m | Starts a new game in mutliplayer hotseat mode $ battleship -s | Starts a new game in which Player2 plays first $ battleship -e | Starts a new game which ends attack turn even if player hits $ battleship -f berk | Starts a new game with name of first player $ battleship -n erol | Starts a new game with name of second player $ battleship -f berk -n erol | Starts a new game with names of first and second players $ battleship -m -f berk | Starts a new game in multiplayer with name of first player

Contribution

Feel free to contribute according to the semistandard rules and latest ECMAScript Specification.

Distribution

You can distribute this software freely under GNU GPL v3.0.