Skip to main content
4 of 16
deleted 8 characters in body
primo
  • 33.7k
  • 5
  • 63
  • 142

Ruby - 143 Bytes

i=t=0 n=gets.scan(/./){t=t<<9|"×\5ËO\35^Þ\7ß_"[$&.to_i].ord*8}.size*2 putc i-n>2?9-1/~t>>=4+i=1&n-=1:' \/'[(t&31>>n%2)[3+n-i+=1]<<i%2]while t>0 

Input is taken from stdin.


Sample Usage

$ more in.dat 0123 $ ruby seven-slash.rb < in.dat /\ /\ /\ / / \ \/ \ /\ \ \ \/ $ more in.dat 456789 $ ruby seven-slash.rb < in.dat /\ \/\ /\ / \/\ /\ \/ \ / \/\ / \/ \/\ \ / \/\ 

Explanation

Output is generated one byte at a time, looping over a bit mask which is constructed from the input. The bits are stored in the following way:

 /\ 10 \/\ 432 /\ \/ -> 10 76 \/\ 432 \/ 76 

The result is stored nine bits to a digit, so that bits 10 spill over into 76 of the next digit. Bit 5 is not used.

primo
  • 33.7k
  • 5
  • 63
  • 142