# Input/Output Problem #6

See here for basic rules on problem.

Input/Output Problem #1

Problem #6

Make an optimal machine that accepts sequences of integer digits 1-4 such that all 1s are at the beginning and all 4s are at the end. Also there has to be exactly one of either the 2 or the 3 with any number of the other in each sequence. There doesn't have to be any 1s or 4s.

You do not need a route for failed sequences. I forgot to mark the left-most node as the start node, but that should be obvious.
One branch produces one 2 with any number of 3s on either side. The other branch does the same for one 3 with any number of 2s either side.

• Scherphius +1 nice answer I believe this is optimal. Nov 14 '18 at 14:24

This should be the optimized version. I added some colored boxes which don't belong to the machine to subdivide its parts

pre edit: "Also there has to be exactly one of either the 2 or the 3."

post edit: "Also there has to be exactly one of either the 2 or the 3 with any number of the other in each sequence."

non-optimized:

not using empty paths

• This solution doesn't accept answers with zero 2 or 3s or more than one 2 or 3s. Nov 14 '18 at 13:04
• @BenFranks "Also there has to be exactly one of either the 2 or the 3." But that's the point of the machine? Nov 14 '18 at 13:05
• I think he means there either has to be exactly one 2 with any number of 3s around it, or exactly one 3 with any number of 2s around it. Nov 14 '18 at 13:13
• @JaapScherphuis That is what I was trying to say. I will reword the puzzle to reflect this clearer. Nov 14 '18 at 13:36
• Your new solution has two arrows marked 2 and two arrows marked 3 leaving the start node. How do I know which one I should take? Nov 14 '18 at 13:54