Skip to content

Instantly share code, notes, and snippets.

@josefdlange
Created August 22, 2016 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josefdlange/04c9eb14a9ddbdfae8eb2e34b91d56df to your computer and use it in GitHub Desktop.
Save josefdlange/04c9eb14a9ddbdfae8eb2e34b91d56df to your computer and use it in GitHub Desktop.
Four-player card draw

Seeing the others' answers I don't think matters in this solution.

The strategy -- given that it's allowable to discuss strategy before drawing cards -- is each person has a different modulo result (x) they have to compute the number they must add [to the sum of the other three], (m) in the following algebra. Solve for m to get the suit your should guess.

x = ([sum of others] + m) % 4

Suits: 0: Diamond 1: Heart 2: Club 3: Spade

Example:

[PLAYER]: (SUIT THEY HAVE), (CHOSEN MODULO RESULT)
A: (0) (0)
B: (1) (1)
C: (3) (2)
D: (3) (3)

For A's m: ((1 + 3 + 3) + m) % 4 == 0, therefore m = 1
For B's m: ((0 + 3 + 3) + m) % 4 == 1, therefore m = 3
For C's m: ((0 + 1 + 3) + m) % 4 == 2, therefore m = 2
For D's m: ((0 + 1 + 3) + m) % 4 == 3, therefore m = 3

D guesses correctly.

There are many permutations of the drawn cards, but I think this one does solve it. All props to the person up this thread who initially answered the 4-player problem; I'm just explaining their methodology as I understood it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment