|
1 | 1 | # Instructions |
2 | 2 |
|
3 | | -Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or whether it is garbled. |
| 3 | +Optical Character Recognition or OCR is software that converts images of text into machine-readable text. |
| 4 | +Given a grid of characters representing some digits, convert the grid to a string of digits. |
| 5 | +If the grid has multiple rows of cells, the rows should be separated in the output with a `","`. |
4 | 6 |
|
5 | | -## Step One |
| 7 | +- The grid is made of one of more lines of cells. |
| 8 | +- Each line of the grid is made of one or more cells. |
| 9 | +- Each cell is three columns wide and four rows high (3x4) and represents one digit. |
| 10 | +- Digits are drawn using pipes (`"|"`), underscores (`"_"`), and spaces (`" "`). |
6 | 11 |
|
7 | | -To begin with, convert a simple binary font to a string containing 0 or 1. |
| 12 | +## Edge cases |
8 | 13 |
|
9 | | -The binary font uses pipes and underscores, four rows high and three columns wide. |
| 14 | +- If the input is not a valid size, your program should indicate there is an error. |
| 15 | +- If the input is the correct size, but a cell is not recognizable, your program should output a `"?"` for that character. |
10 | 16 |
|
11 | | -```text |
12 | | - _ # |
13 | | - | | # zero. |
14 | | - |_| # |
15 | | - # the fourth row is always blank |
16 | | -``` |
| 17 | +## Examples |
17 | 18 |
|
18 | | -Is converted to "0" |
19 | | - |
20 | | -```text |
21 | | - # |
22 | | - | # one. |
23 | | - | # |
24 | | - # (blank fourth row) |
25 | | -``` |
26 | | - |
27 | | -Is converted to "1" |
28 | | - |
29 | | -If the input is the correct size, but not recognizable, your program should return '?' |
30 | | - |
31 | | -If the input is the incorrect size, your program should return an error. |
32 | | - |
33 | | -## Step Two |
34 | | - |
35 | | -Update your program to recognize multi-character binary strings, replacing garbled numbers with ? |
36 | | - |
37 | | -## Step Three |
38 | | - |
39 | | -Update your program to recognize all numbers 0 through 9, both individually and as part of a larger string. |
40 | | - |
41 | | -```text |
42 | | - _ |
43 | | - _| |
44 | | -|_ |
45 | | -
|
46 | | -``` |
47 | | - |
48 | | -Is converted to "2" |
| 19 | +The following input (without the comments) is converted to `"1234567890"`. |
49 | 20 |
|
50 | 21 | ```text |
51 | 22 | _ _ _ _ _ _ _ _ # |
52 | | - | _| _||_||_ |_ ||_||_|| | # decimal numbers. |
| 23 | + | _| _||_||_ |_ ||_||_|| | # Decimal numbers. |
53 | 24 | ||_ _| | _||_| ||_| _||_| # |
54 | | - # fourth line is always blank |
| 25 | + # The fourth line is always blank, |
55 | 26 | ``` |
56 | 27 |
|
57 | | -Is converted to "1234567890" |
58 | | - |
59 | | -## Step Four |
| 28 | +The following input is converted to `"123,456,789"`. |
60 | 29 |
|
61 | | -Update your program to handle multiple numbers, one per line. |
62 | | -When converting several lines, join the lines with commas. |
| 30 | +<!-- prettier-ignore-start --> |
63 | 31 |
|
64 | 32 | ```text |
65 | | - _ _ |
| 33 | + _ _ |
66 | 34 | | _| _| |
67 | 35 | ||_ _| |
68 | | -
|
69 | | - _ _ |
70 | | -|_||_ |_ |
| 36 | + |
| 37 | + _ _ |
| 38 | +|_||_ |_ |
71 | 39 | | _||_| |
72 | | -
|
73 | | - _ _ _ |
| 40 | + |
| 41 | + _ _ _ |
74 | 42 | ||_||_| |
75 | 43 | ||_| _| |
76 | | -
|
| 44 | + |
77 | 45 | ``` |
78 | 46 |
|
79 | | -Is converted to "123,456,789". |
| 47 | +<!-- prettier-ignore-end --> |
0 commit comments