Skip to content

minesweeper: remove border #1602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions exercises/minesweeper/description.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
Add the numbers to a minesweeper board.
Add the mine counts to a completed Minesweeper board.

Minesweeper is a popular game where the user has to find the mines using
numeric hints that indicate how many mines are directly adjacent
(horizontally, vertically, diagonally) to a square.

In this exercise you have to create some code that counts the number of
mines adjacent to a square and transforms boards like this (where `*`
indicates a mine):

+-----+
| * * |
| * |
| * |
| |
+-----+

into this:

+-----+
|1*3*1|
|13*31|
| 2*2 |
| 111 |
+-----+
mines adjacent to a given empty square and replaces that square with the
count.

The board is a rectangle composed of blank space (' ') characters. A mine
is represented by an asterisk ('\*') character.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regarding #1602 (comment) - I'd like to broach the possibility of writing this using backticks. How would that look?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do backticks around quotes (ie ’ ‘ and ’*’, but I’m uncertain that’s any form of improvement on the escaped form. It also implies that the quotes are meant to be included in the board strings, leading to the same problem as the border by another angle. The quotes are necessary to make the blank space clear, as is not going to render very distinctly in all possible readers. Personally I think this fix would cause more significant issues than the one it addresses.

At the end of the day these are markdown files. We need not — and cannot — fight to retain their readability in plaintext as a priority over their readability in a markdown enabled viewer, since that’s their primary means of consumption in the current environment. We could entertain putting a script in the toolchain somewhere that removes all markdown formatting from the generated README that the user downloads (ie README.md -> README.txt), but that would then have to be distinct from the one that’s rendered on the website.


If a given space has no adjacent mines at all, leave that square blank.

## Examples

For example you may receive a 5 x 4 board like this (empty spaces are
represented here with the '·' character for display on screen):

```
·*·*·
··*··
··*··
·····
```

And your code will transform it into this:

```
1*3*1
13*31
·2*2·
·111·
```