Developer Journal, ⠠⠸⠺⠀⠠⠃⠗⠇⠀⠠⠐⠙
Today, as perhaps implied by the post title, is World Braille Day, celebrating the writing system on Louis Braille’s birthday.
On with the code!
Picture to Nonogram
I finished the most basic version of the program. At the end of the run, there’s a grid for comparison purposes, the runs of dark pixels by row, and the runs of dark pixels by column. An example of the latter two follows.
[ [ 16 ], [ 7, 8 ], [ 7, 8 ], [ 6, 7 ], [ 7, 7 ], [ 4, 1, 3 ], [ 3, 5, 3 ], [ 3, 9, 2 ], [ 3, 9, 2 ] ] [ [ 9 ], [ 9 ], [ 9 ], [ 6 ], [ 5, 2 ], [ 5, 3 ], [ 3, 5 ], [ 1, 3 ], [ 3, 3 ], [ 5, 3 ], [ 5, 2 ], [ 5, 2 ], [ 5, 2 ], [ 7 ], [ 9 ], [ 9 ] ]
That’s enough information to solve the puzzle, but I doubt it’s enough information to even begin to guess what the source image might have been. It’s a decent start.
Anyway, I also added some code to enforce a minimum size to the grid—since passing in a square image produces a 1x1 image, which fails to be useful—and did some minor refactoring.
My generic board game code (that hasn’t actually happened) needed a library bumped, so I took care of that, too.
I want to also find a way to set a maximum size of images, since a 1921x1080 image is more than a bit unwieldy. This should probably push out to an actual puzzle to solve, including grabbing a random (Free Culture) image to process, too. It also might not be a bad idea to find a way to (usefully) iterate over the transformation to monochrome, to test with different values to get a puzzle that’s likely to be fun.
And until next time, ⠠⠓⠁⠏⠏⠽⠀⠠⠸⠺⠀⠠⠃⠗⠇⠀⠠⠐⠙⠖
Credits: The header image is Braille closeup by Lrcg2012, released under the terms of the Creative Commons Attribution Share-Alike 3.0 Unported license.
By commenting, you agree to follow the blog's Code of Conduct and that your comment is released under the same license as the rest of the blog.Tags: project devjournal