Yes, it is possible for the prisoners to choose a strategy such that they
will go free, regardless of which hats are chosen.
Label the hats numbers 0 through 6, and label the people numbers 0 through 6.
Then person #i guesses that his hat color is i, minus the sum of all the hat
colors he sees (mod 7). Then person #i is correct exactly when the sum of
everyone's hat color is equal to i (mod 7). So there will always be exactly
one person who is correct: the person whose number is the sum of everyone's
hat color.