minesweeper: adding some help docs and cap timer at 999 seconds.

windows-high-dpi
John Benediktsson 2018-02-24 12:20:00 -08:00
parent 57f69157b1
commit 5cb675486f
2 changed files with 42 additions and 2 deletions

View File

@ -0,0 +1,37 @@
USING: help.markup help.syntax ;
IN: minesweeper
ARTICLE: "minesweeper" "Minesweeper"
"The game starts with a grid of cells. Some cells contain a mine, others do not. If you click on a cell containing a mine, you " { $strong "lose" } " (it blows up!). If you click on all the cells (without clicking on any mines), you " { $strong "win" } "!"
$nl
"Three levels of difficulties are available:"
$nl
{ $table
{ { $strong "Difficulty" } { $strong "Grid Size" } { $strong "Mines" } }
{ "Easy" { $snippet "8 x 8" } "10" }
{ "Medium" { $snippet "16 x 16" } "40" }
{ "Hard" { $snippet "16 x 30" } "99" }
}
$nl
"The upper left corner contains a counter of the number of mines left to find. This number will update as you flag or unflag cells."
$nl
"The upper right corner contains a timer. This timer will count the number of seconds since beginning to play, maxing out at " { $snippet "999" } " (16 minutes and 39 seconds)."
$nl
"Clicking on a cell which doesn't have a mine reveals the number of neighboring cells that contain mines. Use this information (plus good guessing!) to avoid the mines."
$nl
"To open a cell, point at the cell with your mouse and click on it. The first cell you click to open is never a mine."
$nl "Every cell has up to 8 neighbors: the cells adjacent above, below, left, right, and all 4 diagonals. The cells on the sides of the board (and its corners) have fewer neighbors."
$nl
"If you open a cell with no neighboring mines all of its neighbors will automatically open. This can sometimes be a large area."
$nl
"To flag a cell you think is a mine, point and right-click (or hover with the mouse and press " { $snippet "SPACE" } "). Do this again to mark with a question mark symbol (useful if you are unsure about a cell). Do this again to return the cell to blank."
$nl
"If you flag a mine incorrectly, you will need to correct that mistake before you can win."
$nl
"You do not have to flag all the mines to win, you only need to open all the cells that do not contain mines."
$nl
"Click the yellow smiley face (or the desired difficulty) to start a new game."
;
ABOUT: "minesweeper"

View File

@ -7,7 +7,7 @@ destructors formatting fry images.loader kernel locals math
math.order math.parser namespaces opengl opengl.textures random math.order math.parser namespaces opengl opengl.textures random
sequences timers ui ui.commands ui.gadgets ui.gadgets.toolbar sequences timers ui ui.commands ui.gadgets ui.gadgets.toolbar
ui.gadgets.tracks ui.gadgets.worlds ui.gestures ui.pens.solid ui.gadgets.tracks ui.gadgets.worlds ui.gestures ui.pens.solid
ui.render words ; ui.render ui.tools.browser words ;
IN: minesweeper IN: minesweeper
@ -202,7 +202,7 @@ M: grid-gadget pref-dim*
:: draw-timer ( n gadget -- ) :: draw-timer ( n gadget -- )
gadget pref-dim first :> width gadget pref-dim first :> width
n "%03d" sprintf [ n 999 min "%03d" sprintf [
3 swap - 26 * width swap - 3 - 6 2array [ 3 swap - 26 * width swap - 3 - 6 2array [
digit-image-path gadget draw-cached-texture digit-image-path gadget draw-cached-texture
] with-translation ] with-translation
@ -280,10 +280,13 @@ M: grid-gadget draw-gadget*
: com-hard ( gadget -- ) 16 30 99 new-game ; : com-hard ( gadget -- ) 16 30 99 new-game ;
: com-help ( gadget -- ) drop "minesweeper" com-browse ;
grid-gadget "toolbar" f { grid-gadget "toolbar" f {
{ T{ key-down { sym "1" } } com-easy } { T{ key-down { sym "1" } } com-easy }
{ T{ key-down { sym "2" } } com-medium } { T{ key-down { sym "2" } } com-medium }
{ T{ key-down { sym "3" } } com-hard } { T{ key-down { sym "3" } } com-hard }
{ T{ key-down { sym "?" } } com-help }
} define-command-map } define-command-map
grid-gadget "gestures" [ grid-gadget "gestures" [