I hate code bloat!
So I have decided to replace my Windows 7 system by a golfed version. However, I know that it is not easy, so let's build a prototype first. It will take a list of windows from the user and show them using a pseudo-graphic display on the standard output.
For example: user input:
0,0,15,10 15,10,20,15 10,13,15,15 9,1,16,3 17,5,20,7 11,2,17,4 15,4,19,6 13,3,18,5
The Code Golf® Window Manager™ outputs:
┌──────────────┐ │::::::::┌─────┴┐ │::::::::│:┌────┴┐ │::::::::└─┤:┌───┴┐ │::::::::::└─┤::::├┐ │::::::::::::└─┬──┘├┐ │::::::::::::::├─┬─┘│ │::::::::::::::│ └──┘ │::::::::::::::│ │::::::::::::::│ └──────────────┼────┐ │::::│ │::::│ ┌────┤::::│ │::::│::::│ └────┴────┘
Input:
- Taken from standard input (or, if your system has no
stdin
, any method that can provide several lines of input) - Each line contains 4 numbers, delimited by commas - coordinates of a window
- First two numbers: upper-left corner; last two numbers: lower-right corner
- Using
x,y
notation
Output:
- Write it to standard output (or, if your system has no
stdout
, anything that displays monospaced text) - Use single box-drawing characters from Code Page 437 for drawing window boundaries
- Windows specified later in input obscure those specified earlier
- Fill the windows with the colon character:
:
- Leading and trailing spaces are OK, as long as they don't break alignment of the windows
Notes:
- Maximum resolution I want to support: 76 (horizontal) by 57 (vertical)
- No need to support bad input
- Maximum number of windows: 255 (if you need a limit)
- My Windows 7
cmd
shell displays codepage 437 characters by default; if anyone has a way to do that on linux (usingxterm
or whatever), please describe it here
For reference, the character codes are:
┌da ─c4 ┬c2 ┐bf
│b3 :3a │b3 │b3
├c3 ─c4 ┼c5 ┤b4
└c0 ─c4 ┴c1 ┘d9
Total: 12 different characters.
javascript:$('pre').css('line-height','1em')
\$\endgroup\$ – Michael M. Jul 22 '14 at 11:19