The Coffee Bean Puzzle — Solution

If you haven’t looked at the puzzle yet, check out the Coffee Bean Puzzle first.

Solution below…

Getting closer…

Okay. So the operations allowed were described like this:

  1. Pull out two beans at random. If the two beans are the same color, replace them with a white bean.
  2. Pull out two beans at random. If the two beans are different, replace them with a black bean.

You can rephrase the “take two beans out and then do something”  to be a single action like this:

  1. Operation 1 above where both beans were white: remove one white bean.
  2. Operation 1 above where both beans were black: remove two black beans and put in a white bean.
  3. Operation 2 above: remove one white bean.

Note that 1 and 3 are the same operation. So there are really only two operations. You pull out two beans at random to see what to do, and then:

  1. If the beans were both white or were different colors, then take out one white bean and put the other back.
  2. If the beans are both black, remove them and put in a white bean.

Now it’s clearer: you can put in a white bean, and you can remove a white bean, but you can only remove black beans in pairs. Given that, the last bean is determined by the even-ness or odd-ness of the black beans. If they are odd in number, the last bean will be black. Otherwise, because the last black beans will be a pair, which under rule 2 produces a white bean, the last bean will be white.

There is another method of solving this (the one I actually used) that is either overcomplicating the situation, or perhaps offers better insight. I’m trying to devise a more complex variant of this puzzle to see which is the case.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s