## Friday, June 20, 2008

### Sorting a bookshelf

You have a bookshelf with eight books of equal thickness. The first four are fiction, the next four are nonfiction. Your goal is to sort the shelf such that the books alternate: fiction, nonfiction, fiction, nonfiction, etc.

The constraint: You may only move groups of three adjacent books. They must all be moved at once, without changing the order. Note that once you move a group, there are three empty spaces left behind. Books with spaces between them do not count as adjacent. Neither the starting or ending positions should have any empty spaces.

Try to do it in five four moves.

This is based on a similar puzzle in the game 11th Hour. The puzzle in 11th Hour was essentially the same, only that you move groups of two adjacent books instead of three.

See solution

intrinsicallyknotted said...

I'm a little confused on the setup. The fact that moving three books leaves a space where they were implies that the bookshelf has room for arbitrarily many books. So can the new arrangement end up anywhere on the bookcase (such as on the far right, if the original arrangement started on the far left), so long as there are no gaps between books?

miller said...

Yes. Your bookshelf has practically infinite length, although you don't really need more than 14 or so spaces.

miller said...

Hint!

It might be easier to do it backwards.