shapemines

1.2.1 • Public • Published
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.


Readme

Keywords

Package Sidebar

Install

npm i shapemines

Weekly Downloads

0

Version

1.2.1

License

Unlicense

Last publish

Collaborators

  • zzo38