Created
July 4, 2016 16:30
-
-
Save KCreate/f11f680af34d8187fa82212c43cc2d21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const leftpad = require('left-pad'); | |
const fs = require('fs'); | |
const chars = [ | |
[ | |
'┌─┐', | |
'│ │', | |
'│ │', | |
'│ │', | |
'└─┘', | |
], | |
[ | |
' ╵', | |
' │', | |
' │', | |
' │', | |
' ╷', | |
], | |
[ | |
'──┐', | |
' │', | |
'┌─┘', | |
'│ ', | |
'└──', | |
], | |
[ | |
'──┐', | |
' │', | |
'──┤', | |
' │', | |
'──┘', | |
], | |
[ | |
'╵ ╵', | |
'│ │', | |
'└─┤', | |
' │', | |
' ╷', | |
], | |
[ | |
'┌──', | |
'│ ', | |
'└─┐', | |
' │', | |
'──┘', | |
], | |
[ | |
'┌──', | |
'│ ', | |
'├─┐', | |
'│ │', | |
'└─┘', | |
], | |
[ | |
'──┐', | |
' │', | |
' │', | |
' │', | |
' ╷', | |
], | |
[ | |
'┌─┐', | |
'│ │', | |
'├─┤', | |
'│ │', | |
'└─┘', | |
], | |
[ | |
'┌─┐', | |
'│ │', | |
'└─┤', | |
' │', | |
'└─┘', | |
], | |
[ | |
' ', | |
' ', | |
'───', | |
' ', | |
' ', | |
], | |
[ | |
' ', | |
' ', | |
' ', | |
' ', | |
'╷', | |
], | |
]; | |
function display(number) { | |
number = String(number); | |
let line = ''; | |
for (let i = 0; i < 5; i++) { | |
line = ''; | |
number.split('').forEach((e, i2) => { | |
const index = { | |
0: 0, | |
1: 1, | |
2: 2, | |
3: 3, | |
4: 4, | |
5: 5, | |
6: 6, | |
7: 7, | |
8: 8, | |
9: 9, | |
'-': 10, | |
'.': 11, | |
}[e]; | |
line += chars[index][i]; | |
line += ' '; | |
}); | |
console.log(line); | |
} | |
} | |
const input = fs.readFileSync('/dev/stdin').toString(); | |
result = parseInt(Number(input), 2); | |
result = (result - 302) / 10; | |
display(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment