The solution to the 4 person problem is actually pretty simple.
Let's assume that we know the answer to the 2 person problem.
We have 4 persons; A, B, C and D.
At first the persons guess their colour (without revealing it of course) based on their direct neighbor.
So for instance:
A <-----> B
C <-----> D
A and B being neighbors, they guess their colours based on the solution of the 2 persons problem. Same goes for C and D.
Without loss of generality, let's assume C guesses correctly his card colour.
Since he can see the cards of A and B, he knows who will guess their colour correctly.
For instance, if they have the same colour, A will guess correctly, if not, then B will guess correctly.
Without loss of generality, let's assume A guesses correctly his card colour. He then sees that C will guess correctly.The participants agreed beforehand that clubs and hearts are associated with 0 while diamonds and spades are associated with 1. A and C now apply the solution to the 2 person problem to guess their shape group (either (diamonds or spades) or (clubs or hearts)):
A B
|
|
C D
It is guaranteed that at least one has guessed the shape group correctly. Since they both guessed correctly the color, it is guaranteed that one of them will guess the shape correctly.