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

shapemines

v1.2.1

Published

Minesweeper game with possibility of different grid shapes and rules

Downloads

13

Readme

This program is public domain and require SDLTERM.

Command-line options are specified by name, equal, and value. For booleans
you specify any non-empty value for true or empty for false.

- volume = The sound effect volume, normally 3000, and can range 0 to
32767. If it is zero then sound is disabled.

- size = The grid size. What it means depends on the grid shape; for the
default shape, you can specify it in order to make a square grid rather
than setting width and height separately.

- width = The width of the grid.

- height = The height of the grid.

- bombs = How many bombs.

- shape = The grid shape and adjacency file. The default is a rectangular
grid using king's adjacency. See the list below for what shapes are
possible. (You can also make up your own.)

- graphics = The graphics file to use. Currently, only the default
graphics are defined and there are no others (but you can make new ones).

- penalty = If set to a number, then touching a bomb will not cause you to
lose the game immediately but instead results in a penalty of that many
seconds being charged into your score.

- initial = Tell how many cells are initially exposed (normally zero).

- testadj = If set, enters adjacency testing mode, for testing grid shape
programs in order to check that it is working properly.

- turnwise = If set, uses turn-based scoring instead of time-based. The
penalty is how many turns it counts as if you touch a bomb instead of how
many seconds of time penalty. In this mode, you must push W once you have
marked all of the bombs and then it tell you if you win or lose.

- safecorner = If set, the corners of the board do not contain bombs. This
option is useful only when the default grid shape is used.

To play game, use button 1 to step on if you think is not the bomb, in
order to reveal numbers to tell how many bombs adjacent, and use button 3
to add or remove a flag. You can also use button 2 to add a question mark
to the tile.

The keyboard controls are Q to quit, R to restart the game, and S to take
a screenshot (saved into "screenshot.png"; you require Farbfeld Utilities
in your PATH in order to take a screenshot in this way).


=== Available grid shapes ===

The available grid shapes are:

- bigcell = Like the default grid but some cells are larger. Cells are
counted as adjacent if an edge or corner is shared; each cell counts only
once.

- default = The normal mine sweeper game, with square tiles and with
king's adjacency.

- double = Like default but orthogonal adjacencies count double.

- holes = Like default but there are holes in the grid. These holes have
no bombs and you cannot see numbers in these holes either.

- knight = Like default but using knight's adjacency instead.

- wrap = Like default but the board wraps around.


=== Graphics definitions ===

The graphics file must be a gzipped file containing the icons to use in
the game. Each icon is 16x16, with four bytes per pixel, in order starting
from top left corner and moving to right. The four bytes per pixel are the
red, green, blue, and alpha channels, but alpha is currently unused (you
should set the alpha value to 255).

The outer edge of each icon should be the tile border, while the next
inner edge should be blank (for use with non-square grids) unless you
will wish the graphic to extend even for larger grids.

The icons in the file are consecutive with no headers or anything like
that (except for the gzip header). Here is a list of the required order of
the icons (where the first icon is number zero):

   0 = no tile
   1 = uncovered unmarked
   2 = flag
   3 = double flag
   4 = question mark
   5-17 = zero to twelve adjacent bombs
   18 = bomb
   19 = double bomb
   20 = marked incorrect
   21 = uncovered bomb
   22 = uncovered double bomb
   23 = more than twelve adjacent bombs

The "no tile" icon is used when the tile does not exist in the grid (see
the shape definitions below for how this works). The "double flag" and
"double bomb" icons are currently unused.


=== Shape definitions ===

The shape definition is a JavaScript code, where module.exports must be
set to a function with three arguments; these three arguments are the
arguments given as command-line parameters (size,width,height). If the
width and/or height are not specified, they are zero.

The return value of that function is an object, with the properties:

- pwidth = Picture width.

- pheight = Picture height.

- picture = Picture data, which defines where each grid cell is on the
screen; the size is given by pwidth and pheight. The order is starting
from the bottom left corner (not top left corner) and going to right.
There are four bytes per pixel. The first two are the grid coordinate,
while the last two are numbers 0 to 15 specifying the icon coordinate.
(See the included file for an example.)

- gwidth = Grid width.

- gheight = Grid height.

- adjacency = A function with two arguments being the X and Y coordinates
in the grid. If the specified coordinates do not point to a valid tile
then this function should return null, otherwise it should return an array
where each element is an array of the X and Y coordinates of an adjacent
grid cell (it is OK to include coordinates of non-existent cells too). It
is required that if A is adjacent to B, so is B adjacent to A. You can
have an adjacency counted multiple times; if so, then the mutual adjacency
must go both ways the same number of times.