Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
201 changes: 201 additions & 0 deletions exercises/flower-field/canonical-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"exercise": "flower-field",
"comments": [
" The expected outputs are represented as arrays of strings to ",
" improve readability in this JSON file. ",
" Your track may choose whether to present the input as a single ",
" string (concatenating all the lines) or as the list. "
],
"cases": [
{
"uuid": "237ff487-467a-47e1-9b01-8a891844f86c",
"description": "no rows",
"property": "annotate",
"input": {
"garden": []
},
"expected": []
},
{
"uuid": "4b4134ec-e20f-439c-a295-664c38950ba1",
"description": "no columns",
"property": "annotate",
"input": {
"garden": [""]
},
"expected": [""]
},
{
"uuid": "d774d054-bbad-4867-88ae-069cbd1c4f92",
"description": "no flowers",
"property": "annotate",
"input": {
"garden": [
" ",
" ",
" "
]
},
"expected": [
" ",
" ",
" "
]
},
{
"uuid": "225176a0-725e-43cd-aa13-9dced501f16e",
"description": "garden full of flowers",
"property": "annotate",
"input": {
"garden": [
"***",
"***",
"***"
]
},
"expected": [
"***",
"***",
"***"
]
},
{
"uuid": "3f345495-f1a5-4132-8411-74bd7ca08c49",
"description": "flower surrounded by spaces",
"property": "annotate",
"input": {
"garden": [
" ",
" * ",
" "
]
},
"expected": [
"111",
"1*1",
"111"
]
},
{
"uuid": "6cb04070-4199-4ef7-a6fa-92f68c660fca",
"description": "space surrounded by flowers",
"property": "annotate",
"input": {
"garden": [
"***",
"* *",
"***"
]
},
"expected": [
"***",
"*8*",
"***"
]
},
{
"uuid": "272d2306-9f62-44fe-8ab5-6b0f43a26338",
"description": "horizontal line",
"property": "annotate",
"input": {
"garden": [" * * "]
},
"expected": ["1*2*1"]
},
{
"uuid": "c6f0a4b2-58d0-4bf6-ad8d-ccf4144f1f8e",
"description": "horizontal line, flowers at edges",
"property": "annotate",
"input": {
"garden": ["* *"]
},
"expected": ["*1 1*"]
},
{
"uuid": "a54e84b7-3b25-44a8-b8cf-1753c8bb4cf5",
"description": "vertical line",
"property": "annotate",
"input": {
"garden": [
" ",
"*",
" ",
"*",
" "
]
},
"expected": [
"1",
"*",
"2",
"*",
"1"
]
},
{
"uuid": "b40f42f5-dec5-4abc-b167-3f08195189c1",
"description": "vertical line, flowers at edges",
"property": "annotate",
"input": {
"garden": [
"*",
" ",
" ",
" ",
"*"
]
},
"expected": [
"*",
"1",
" ",
"1",
"*"
]
},
{
"uuid": "58674965-7b42-4818-b930-0215062d543c",
"description": "cross",
"property": "annotate",
"input": {
"garden": [
" * ",
" * ",
"*****",
" * ",
" * "
]
},
"expected": [
" 2*2 ",
"25*52",
"*****",
"25*52",
" 2*2 "
]
},
{
"uuid": "dd9d4ca8-9e68-4f78-a677-a2a70fd7a7b8",
"description": "large garden",
"property": "annotate",
"input": {
"garden": [
" * * ",
" * ",
" * ",
" * *",
" * * ",
" "
]
},
"expected": [
"1*22*1",
"12*322",
" 123*2",
"112*4*",
"1*22*2",
"111111"
]
}
]
}
26 changes: 26 additions & 0 deletions exercises/flower-field/instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Instructions

Your task is to add flower counts to empty squares in a completed Flower Field board.
The board itself is a rectangle composed of squares that are either empty (`' '`) or a flower (`'*'`).

For each empty square, count the number of flowers adjacent to it (horizontally, vertically, diagonally).
If the empty square has no adjacent flowers, leave it empty.
Otherwise replace it with the count of adjacent flowers.

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

```text
·*·*·
··*··
··*··
·····
```

Which your code should transform into this:

```text
1*3*1
13*31
·2*2·
·111·
```
7 changes: 7 additions & 0 deletions exercises/flower-field/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Introduction

[Flower Field][Wikipedia] is a compassionate reimagining of the popular game Minesweeper.
The object of the game is to find all the flowers in the garden using numeric hints that indicate how many flowers are directly adjacent (horizontally, vertically, diagonally) to a square.
"Flower Field" shipped in regional versions of Microsoft Windows in Italy, Germany, South Korea, Japan and Taiwan.

[Wikipedia]: https://en.wikipedia.org/wiki/Minesweeper_(video_game)#History
4 changes: 4 additions & 0 deletions exercises/flower-field/metadata.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
title = "Flower Field"
blurb = "Help avoid stepping on the flowers in a flower garden."
deep_dive_youtube_id = "dLT2h2hODhs"
deep_dive_blurb = "We explore nested for loops, clever use of min/max to simplify bounds checking, functional pipelines and using two-dimensional matrices."
3 changes: 3 additions & 0 deletions exercises/minesweeper/.deprecated
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**NOTE: This exercise has been deprecated**
Your track should implement "flower-field" instead.
https://forum.exercism.org/t/suggestion-deprecate-minesweeper-for-flower-field/17967
Loading