You have 8 cards (pieces of paper) numbered from 1 to 8. The first 4 are all white, and the last 4 are all black. On each one is written:
#1: The next two cards are black.
#2: The next two cards are of different colors.
#3: The previous card has the same color as the next.
#4: There are the same number of black cards before and after this one.
#5: The previous card is of the same color as the next.
#6: The previous card is white.
#7: The next two cards are of the same color.
#8: The previous card is black.
Arrange the 8 cards in a row so that all the sentences result truthfully.
(a) According to Message #4, we cannot have 3 blacks in a row.
(b) Card #1 is followed by 2 black cards. The black card immediately after #1 cannot be #5 (which is between two cards of the same color) or #8 (which is after a black card). And it cannot be #7, because that would require 3 black cards in a row. So, #6 is after #1.
(c) And what card is last? It cannot be 1,2,3,4,5 or 7, since those are all followed by another card (based on their messages). And it cannot be #6, since according to (b) there is a black after #6. So, the last card is black #8.
(d) #8, the last card, is (according to its message) preceded by another black card. Which one? It cannot be #5 (because that would imply 3 blacks in a row), or #7 (which has at least 2 cards after it), so #6 is in the 7th position and #1 is in the 6th position. The last three cards are:
wbb
168
(e) And from Message #4, the card before #1 must be white. So we have
???? wwbb
???? ?168
(f) And what card is first? It cannot be 3,4, or 5 (based on their messages), so it must be 2 or 7.
(g) If the first card is 7, then it must be followed by two white cards, so the cards are:
bwwb wwbb
7 ? ? ? ? 168
But this leaves no place for #3, a white card surrounded by two cards of the same color.
Therefore, #2 must be the first card, and the cards are:
w??? wwbb
2 ??? ? 168
(h) And since #2 is followed by two different colors, this makes the full pattern
either wwbbwwbb or wbwbwwbb. The first pattern again leaves no place for #3,
so the cards must be
wbwb wwbb
2 ?3? ? 168
(i) #4 is the last white card, #7 is the black card before two whites, and #5 is the remaining card which is between two cards of the same color. So, the final and only solution is
wbwb wwbb
2 537 4168, just as Charlie's computer program said.
Nice problem, pcbouhid!
Edited on January 31, 2009, 11:14 pm