```Chris Shea wrote:
> ... I hope others share some.

Below is a (very ugly) machine to convert binary to octal,
since it seems binary is the popular test representation.

\$ ruby quiz-162 to_oct.tm
0

\$ ruby quiz-162 to_oct.tm 0
0

\$ ruby quiz-162 to_oct.tm 101
5

\$ ruby quiz-162 to_oct.tm 000001010011100101110111
1234567

An annotated example:
\$ ruby quiz-162 to_oct.tm 0011101
# Span to the end of the binary digits; mark the end.
span_end  0  ->  span_endB 0 R  :        >0< 0  1  1  1  0  1
span_endB 0  ->  span_endB 0 R  :         0 >0< 1  1  1  0  1
span_endB 1  ->  span_endB 1 R  :         0  0 >1< 1  1  0  1
span_endB 1  ->  span_endB 1 R  :         0  0  1 >1< 1  0  1
span_endB 1  ->  span_endB 1 R  :         0  0  1  1 >1< 0  1
span_endB 0  ->  span_endB 0 R  :         0  0  1  1  1 >0< 1
span_endB 1  ->  span_endB 1 R  :         0  0  1  1  1  0 >1<
span_endB _  ->  cvt_xxx   X L  :         0  0  1  1  1  0  1 >_<
# Convert each set of three binary digits to an octal digit.
cvt_xxx   1  ->  cvt_xx1   _ L  :         0  0  1  1  1  0 >1< X
cvt_xx1   0  ->  cvt_x01   _ L  :         0  0  1  1  1 >0< _  X
cvt_x01   1  ->  cvt_xxx   5 L  :         0  0  1  1 >1< _  _  X
cvt_xxx   1  ->  cvt_xx1   _ L  :         0  0  1 >1< 5  _  _  X
cvt_xx1   1  ->  cvt_x11   _ L  :         0  0 >1< _  5  _  _  X
cvt_x11   0  ->  cvt_xxx   3 L  :         0 >0< _  _  5  _  _  X
cvt_xxx   0  ->  cvt_xx0   _ L  :        >0< 3  _  _  5  _  _  X
cvt_xx0   _  ->  squeeze   0 L  :     >_< _  3  _  _  5  _  _  X
# Squeeze intervening spaces.
squeeze   _  ->  squeezeA  _ R  :  >_< 0  _  3  _  _  5  _  _  X
squeezeA  0  ->  squeezeA  _ R  :   _ >0< _  3  _  _  5  _  _  X
squeezeA  _  ->  squeezeA  _ R  :   _  _ >_< 3  _  _  5  _  _  X
squeezeA  3  ->  squeezeB  3 R  :   _  _  _ >3< _  _  5  _  _  X
squeezeB  _  ->  squeezeC  X R  :   _  _  _  3 >_< _  5  _  _  X
squeezeC  _  ->  squeezeC  _ R  :   _  _  _  3  X >_< 5  _  _  X
squeezeC  5  ->  squeeze5  _ L  :   _  _  _  3  X  _ >5< _  _  X
squeeze5  _  ->  squeeze5  _ L  :   _  _  _  3  X >_< _  _  _  X
squeeze5  X  ->  squeezeD  5 R  :   _  _  _  3 >X< _  _  _  _  X
squeezeD  _  ->  squeezeC  X R  :   _  _  _  3  5 >_< _  _  _  X
squeezeC  _  ->  squeezeC  _ R  :   _  _  _  3  5  X >_< _  _  X
squeezeC  _  ->  squeezeC  _ R  :   _  _  _  3  5  X  _ >_< _  X
squeezeC  _  ->  squeezeC  _ R  :   _  _  _  3  5  X  _  _ >_< X
squeezeC  X  ->  squeezeX  _ L  :   _  _  _  3  5  X  _  _  _ >X<
squeezeX  _  ->  squeezeX  _ L  :   _  _  _  3  5  X  _  _ >_< _
squeezeX  _  ->  squeezeX  _ L  :   _  _  _  3  5  X  _ >_< _  _
squeezeX  _  ->  squeezeX  _ L  :   _  _  _  3  5  X >_< _  _  _
squeezeX  X  ->  __done__  _ L  :   _  _  _  3  5 >X< _  _  _  _
__done__  5  ->  --none--       :   _  _  _  3 >5< _  _  _  _  _
---> '35'

\$ cat to_oct.tm

#
# Convert binary to octal.
#

#
# Span to the end of the binary digits; mark the end.
#
span_end   0  span_endB  0  R
span_end   1  span_endB  1  R
span_end   _  __done__   0  R
span_endB  0  span_endB  0  R
span_endB  1  span_endB  1  R
span_endB  _  cvt_xxx    X  L

#
# Convert each set of three binary digits to an octal digit.
#
cvt_xxx  0  cvt_xx0  _  L
cvt_xxx  1  cvt_xx1  _  L
cvt_xxx  _  squeeze  0  L

cvt_xx0  0  cvt_x00  _  L
cvt_xx0  1  cvt_x10  _  L
cvt_xx0  _  squeeze  0  L

cvt_x00  0  cvt_xxx  0  L
cvt_x00  1  cvt_xxx  4  L
cvt_x00  _  squeeze  0  L

cvt_x10  0  cvt_xxx  2  L
cvt_x10  1  cvt_xxx  6  L
cvt_x10  _  squeeze  2  L

cvt_xx1  0  cvt_x01  _  L
cvt_xx1  1  cvt_x11  _  L
cvt_xx1  _  squeeze  1  L

cvt_x01  0  cvt_xxx  1  L
cvt_x01  1  cvt_xxx  5  L
cvt_x01  _  squeeze  1  L

cvt_x11  0  cvt_xxx  3  L
cvt_x11  1  cvt_xxx  7  L
cvt_x11  _  squeeze  3  L

#
# Squeeze intervening spaces.
#
squeeze   _  squeeze   _  R
squeeze   0  squeeze   _  R
squeeze   1  squeezeB  1  R
squeeze   2  squeezeB  2  R
squeeze   3  squeezeB  3  R
squeeze   4  squeezeB  4  R
squeeze   5  squeezeB  5  R
squeeze   6  squeezeB  6  R
squeeze   7  squeezeB  7  R
squeeze   X  __done__  0  R
squeezeB  _  squeezeC  X  R
squeezeC  _  squeezeC  _  R

squeezeC  0  squeeze0  _  L
squeeze0  _  squeeze0  _  L
squeeze0  X  squeezeD  0  R
squeezeD  _  squeezeC  X  R

squeezeC  1  squeeze1  _  L
squeeze1  _  squeeze1  _  L
squeeze1  X  squeezeD  1  R

squeezeC  2  squeeze2  _  L
squeeze2  _  squeeze2  _  L
squeeze2  X  squeezeD  2  R

squeezeC  3  squeeze3  _  L
squeeze3  _  squeeze3  _  L
squeeze3  X  squeezeD  3  R

squeezeC  4  squeeze4  _  L
squeeze4  _  squeeze4  _  L
squeeze4  X  squeezeD  4  R

squeezeC  5  squeeze5  _  L
squeeze5  _  squeeze5  _  L
squeeze5  X  squeezeD  5  R

squeezeC  6  squeeze6  _  L
squeeze6  _  squeeze6  _  L
squeeze6  X  squeezeD  6  R

squeezeC  7  squeeze7  _  L
squeeze7  _  squeeze7  _  L
squeeze7  X  squeezeD  7  R

squeezeC  X  squeezeX   _  L
squeezeX  _  squeezeX   _  L
squeezeX  X  __done__   _  L

```