19
Write a program that translates ASCII text to braille output. Requirements:
- Input may come from stdin, command line, or some other external input source.
- Output should be recognisable as braille, the form of output is up to you. An example would be
ofor a raised dot and.for a non-raised dot. Textual pattern representation such as1-3-4is not acceptable. Long line wrapping is not required. - Only the 26 alphabet characters and space are required for a minimal solution. All input characters not supported by your solution should be ignored.
Scoring is by number of characters in the source code. Penalties and bonuses are:
- +50 penalty for using Unicode braille characters as output.
- -50 bonus for supporting capitals, numbers, and punctuation.
-200 bonus for supporting ligatures and one-letter contractions from English (Grade-2) Braille.(Will make this a separate challenge since it's quite a different problem.)
Sample invocation and output (minimal solution):
$ braille Hello world
o . o . o . o . o . . . . o o . o . o . o o
o o . o o . o . . o . . o o . o o o o . . o
. . . . o . o . o . . . . o o . o . o . . .

define "valiant attempt". Also, is line-wrapping required? – John Dvorak – 2014-07-04T02:20:26.910
@JanDvorak: Thanks, updated question. – Greg Hewgill – 2014-07-04T02:23:45.870
I'm sorry, but a single example doesn't cut it in a code golf specification. Please give us the objective minimal requirements to qualify for the bonus. – John Dvorak – 2014-07-04T02:30:08.580
@JanDvorak: Fair point, I've removed the "valiant attempt" weasel words. There is considerable variation in real world use of these contractions, and fully spelling out contractable words using only letters is valid but considered clumsy by braille readers. – Greg Hewgill – 2014-07-04T02:53:07.280
What punctuation do we need to support? Some symbols don't have a standard braille equivalent. – qwr – 2014-07-04T04:42:57.827
@qwr the basic punctuation listed in the braille Wikipedia article. – Greg Hewgill – 2014-07-04T04:45:57.310
1@GregHewgill Can you make the bonus for including capitals, numbers, and punctuation larger? Currently that's 26+10+12 = 48 extra characters, not much of a bonus (unless you compress the braille data) – qwr – 2014-07-04T04:48:36.717
@qwr: I'm not going to change the bonus at this point. Note that capitals aren't separate letter codes, but a prefix code that means "the next letter is capital". – Greg Hewgill – 2014-07-04T08:34:28.390
1You could count bytes instead of characters and remove the penalty, the cost is about the same (@DigitalTrauma's first solution is 85 bytes). Edit: I just realized that would penalize languages like APL. It's up to you. – nyuszika7h – 2014-07-04T17:19:58.187
can the output be vertical? – xem – 2014-07-04T18:13:41.790
1Man... the penalty for unicode chars isn't big enough to make this interesting. I wanted to see how people were going to encode the braille set. – Almo – 2014-07-04T20:37:09.337
Which English grade-2 Braille? American, British or Unified? – aditsu quit because SE is EVIL – 2014-07-05T15:54:23.977
@aditsu: I'm probably going to make the Grade-2 challenge a separate problem, and specify the requirements carefully. – Greg Hewgill – 2014-07-05T22:15:50.357
@GregHewgill from what I've seen around here (to my dismay), that would likely get a bunch of downvotes and be closed as a duplicate – aditsu quit because SE is EVIL – 2014-07-06T06:38:04.357