24
10
Task
The task is to display any of the 128 possible states of a 7-segment display.
Your program should accept a string of 7 characters ("bits") that are either 0
or 1
.
First bit of input corresponds to segment A of the following illustration, the
second to B, etc (ignore dp
):
How you represent the display is up to you -- a single Unicode or ASCII symbol, ASCII art, grafically, or whatever you can come up with. However, each input must have it's own distinct output. If you come up with something fancy I'm sure you can harvest upvotes by showing off some examples.
All 128 possible states of the display are:
Rules
- Codegolf
- As I said, any kind of output is allowed, but it would be nice if you specified it.
- Input can be stdin or command line argument.
Examples
Input
1101101
Output
As ASCII/Unicode:2
Different kinds of ASCII art (I'm not too good at this)
_ ╺┓ ╒╗ ---
_| ┏┛ ╔╝ |
|_ ┗╸ ╚╛ ---
|
---
Closely related to http://codegolf.stackexchange.com/questions/997/render-digital-clock-style-numbers ?
– DavidC – 2012-12-20T21:49:36.540@DavidCarraher: They're related, yes; I even linked to it myself. However, this is slightly harder I would say, as you have 118 more 'numbers' to generate. Most(?) of the answers to the other question would not work here, or would have to be heavily rewritten. Also, here you don't need to encode the different numbers, so other optimizations shuld be possible. – daniero – 2012-12-20T22:02:33.900
You are correct. Thanks for pointing that out. – DavidC – 2012-12-20T23:58:36.627
it is a requirement that we use the encoding you provided? e.g. "1101101" should always represent "2" ? – ardnew – 2012-12-21T17:58:42.280
@ardnew: yes. The position of the bits in input should map to the alphabetical order of the segments A to G in the first picture. – daniero – 2012-12-21T21:19:00.913
@Daniero In case the program uses an external resource, should the size of that resource be added to the total character (byte) count? – Cristian Lupascu – 2012-12-27T20:34:45.337
@w0lf I'll say that loading images and graphics externally is OK. Loading external scripts, or other resources that handle logic etc, is not. – daniero – 2012-12-28T21:54:36.953