From 8745cb111afd954fdb58afe2113ffe790ad5ee6b Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Sat, 22 Nov 2025 09:51:59 -0800 Subject: [PATCH 1/4] Rewrite the OCR instructions See [forum discssion](https://forum.exercism.org/t/rewrite-instructions-for-ocr-numbers/19894). --- exercises/ocr-numbers/instructions.md | 70 ++++++--------------------- 1 file changed, 16 insertions(+), 54 deletions(-) diff --git a/exercises/ocr-numbers/instructions.md b/exercises/ocr-numbers/instructions.md index 7beb25779..1462a13e2 100644 --- a/exercises/ocr-numbers/instructions.md +++ b/exercises/ocr-numbers/instructions.md @@ -1,67 +1,31 @@ -# Instructions +Optical Character Recognition or OCR is software that converts images of text into machine-readable text. +Given a grid of characters representing some digits, convert the grid to a string of digits. +If the grid has multiple rows of cells, the rows should be separated in the output with a `","`. -Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or whether it is garbled. +* The grid is made of one of more lines of cells. +* Each line of the grid is made of one or more cells. +* Each cell is three columns wide and four rows high (3x4) and represents one digit. +* Digits are drawn using pipes (`"|"`), underscores (`"_"`), and spaces (`" "`). -## Step One +## Edge cases -To begin with, convert a simple binary font to a string containing 0 or 1. +* If the input is not a valid size, your program should indicate there is an error. +* If the input is the correct size, but a cell is not recognizable, your program should output a `"?"` for that character. -The binary font uses pipes and underscores, four rows high and three columns wide. +## Examples -```text - _ # - | | # zero. - |_| # - # the fourth row is always blank -``` - -Is converted to "0" - -```text - # - | # one. - | # - # (blank fourth row) -``` - -Is converted to "1" - -If the input is the correct size, but not recognizable, your program should return '?' - -If the input is the incorrect size, your program should return an error. - -## Step Two - -Update your program to recognize multi-character binary strings, replacing garbled numbers with ? - -## Step Three - -Update your program to recognize all numbers 0 through 9, both individually and as part of a larger string. - -```text - _ - _| -|_ +The following input (without the comments) is converted to `"1234567890"`. ``` - -Is converted to "2" - -```text _ _ _ _ _ _ _ _ # - | _| _||_||_ |_ ||_||_|| | # decimal numbers. + | _| _||_||_ |_ ||_||_|| | # Decimal numbers. ||_ _| | _||_| ||_| _||_| # - # fourth line is always blank + # The fourth line is always blank, ``` -Is converted to "1234567890" +The following input is converted to `"123,456,789"`. -## Step Four - -Update your program to handle multiple numbers, one per line. -When converting several lines, join the lines with commas. - -```text +``` _ _ | _| _| ||_ _| @@ -75,5 +39,3 @@ When converting several lines, join the lines with commas. ||_| _| ``` - -Is converted to "123,456,789". From 65d8c95b9e067b7ba4a47a09fc837c9641bed5cc Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Sat, 22 Nov 2025 12:59:40 -0800 Subject: [PATCH 2/4] Update exercises/ocr-numbers/instructions.md Co-authored-by: Victor Goff --- exercises/ocr-numbers/instructions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exercises/ocr-numbers/instructions.md b/exercises/ocr-numbers/instructions.md index 1462a13e2..c42f27da6 100644 --- a/exercises/ocr-numbers/instructions.md +++ b/exercises/ocr-numbers/instructions.md @@ -1,3 +1,5 @@ +# Instructions + Optical Character Recognition or OCR is software that converts images of text into machine-readable text. Given a grid of characters representing some digits, convert the grid to a string of digits. If the grid has multiple rows of cells, the rows should be separated in the output with a `","`. From 79e2b9405260e7225ca053926e302f92f4b16f86 Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Sat, 22 Nov 2025 13:01:09 -0800 Subject: [PATCH 3/4] Apply suggestions from code review --- exercises/ocr-numbers/instructions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/ocr-numbers/instructions.md b/exercises/ocr-numbers/instructions.md index c42f27da6..9673590a3 100644 --- a/exercises/ocr-numbers/instructions.md +++ b/exercises/ocr-numbers/instructions.md @@ -18,7 +18,7 @@ If the grid has multiple rows of cells, the rows should be separated in the outp The following input (without the comments) is converted to `"1234567890"`. -``` +```text _ _ _ _ _ _ _ _ # | _| _||_||_ |_ ||_||_|| | # Decimal numbers. ||_ _| | _||_| ||_| _||_| # @@ -27,7 +27,7 @@ The following input (without the comments) is converted to `"1234567890"`. The following input is converted to `"123,456,789"`. -``` +```text _ _ | _| _| ||_ _| From 3e2680078a46abf37b7280a7f44ab95fac6c822d Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Sat, 22 Nov 2025 18:14:59 -0800 Subject: [PATCH 4/4] Change bullet point formatting --- exercises/ocr-numbers/instructions.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exercises/ocr-numbers/instructions.md b/exercises/ocr-numbers/instructions.md index 9673590a3..f0a60ea8a 100644 --- a/exercises/ocr-numbers/instructions.md +++ b/exercises/ocr-numbers/instructions.md @@ -4,15 +4,15 @@ Optical Character Recognition or OCR is software that converts images of text in Given a grid of characters representing some digits, convert the grid to a string of digits. If the grid has multiple rows of cells, the rows should be separated in the output with a `","`. -* The grid is made of one of more lines of cells. -* Each line of the grid is made of one or more cells. -* Each cell is three columns wide and four rows high (3x4) and represents one digit. -* Digits are drawn using pipes (`"|"`), underscores (`"_"`), and spaces (`" "`). +- The grid is made of one of more lines of cells. +- Each line of the grid is made of one or more cells. +- Each cell is three columns wide and four rows high (3x4) and represents one digit. +- Digits are drawn using pipes (`"|"`), underscores (`"_"`), and spaces (`" "`). ## Edge cases -* If the input is not a valid size, your program should indicate there is an error. -* If the input is the correct size, but a cell is not recognizable, your program should output a `"?"` for that character. +- If the input is not a valid size, your program should indicate there is an error. +- If the input is the correct size, but a cell is not recognizable, your program should output a `"?"` for that character. ## Examples