Here’s my solution (it’s the one in the book):
And here’s the link:
Description: The 3 bits on top distribute the first 4 balls into 4 different paths. Each path tests the value of a bit, starting with the top bit and working down. If it points left, the next ball will be red, if it points right, the next ball will be blue.
I’m pretty sure there’s a way to do this with less parts, but I haven’t figured it out, yet.