Skip to content

Commit ff2ad1e

Browse files
committed
more ocr
1 parent b52f690 commit ff2ad1e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Lib/Ocr.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
namespace AdventOfCode;
55

66
static class OcrExtension {
7-
public static OcrString Ocr(this string st, int charWidth = 5, int charHeight = 5){
7+
public static OcrString Ocr(this string st, int charWidth = 5, int charHeight = 6){
88
return new OcrString(st, charWidth, charHeight);
99
}
1010
}
1111

12-
record OcrString (string st, int charWidth = 5, int charHeight = 5) {
12+
record OcrString (string st, int charWidth, int charHeight) {
1313
public override string ToString() {
1414
var lines = st.Split("\n");
1515
var width = lines[0].Length;
1616
var height = lines.Length;
1717

1818
var dict = new Dictionary<long, string>{
19-
// 5 x 5
19+
// 5 x 6
2020
{0x19297A52, "A"},
2121
{0x3252F4A4, "A"},
2222
{0x725C94B8, "B"},
@@ -40,11 +40,11 @@ public override string ToString() {
4040
{0x7844443C, "Z"},
4141

4242
// 8x10
43-
{0x09F109090909F000, "B"},
44-
{0x010101010108F000, "C"},
45-
{0x010139090918E800, "G"},
46-
{0x101010111110E000, "J"},
47-
{0x102040810101F800, "Z"},
43+
{0x909F109090909F0, "B"},
44+
{0x1010101010108F0, "C"},
45+
{0x1010139090918E8, "G"},
46+
{0x10101010111110E0, "J"},
47+
{0x8102040810101F8, "Z"},
4848

4949
{0, ""},
5050
};
@@ -54,7 +54,7 @@ public override string ToString() {
5454
for (var ch = 0; ch < Math.Ceiling(width / (double)charWidth); ch++) {
5555
var hash = 0L;
5656
var stChar = "";
57-
for (var irow = 0; irow <= charHeight; irow++) {
57+
for (var irow = 0; irow < charHeight; irow++) {
5858
for (var i = 0; i < charWidth; i++) {
5959
var icol = (ch * charWidth) + i;
6060
var point = irow < height && icol < lines[irow].Length ? lines[irow][icol] : ' ';

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy