# How can players randomly - and secretly - choose 5 cards out of 25 that match a specific condition

So this is a less a coding question and more a 'there's gotta be a way'...

I have a Clue-like logic/deduction board game that has 25 cards - 5 of each color and 5 of each taste. Each card is unique, and has a unique combination of color and taste.

Just like in Clue, I want to have players randomly choose some cards that make up the answer they're trying to discover through logic and deduction. In previous versions, one side of the cards (the back side) had the taste of the card, and the correct answer would have exactly one of each taste. After some playtesting, a suggestion was made to have the correct answer have 5 cards, including exactly one card of each color and taste...

So that's what I'm trying to do. Players need to secretly determine this for themselves by using just some playing cards. One side needs to have the actual combination of color and taste on it, but anything can be on the back to make it work. I've tinkered with numbers and bar-code-like graphics, but anything's possible here (numbers shouldn't be easily memorized, naturally, and the backs of the cards should be able to remain visible without this system giving away what's on the other side...

• So do you want something that allows players to use what's on the back to uniquely identify what's on the front? What would be the point of this if they only need to see what's on the front once to remember that? Or do the cards move around so they wouldn't be able to track an individual card without having some identifier? Or do you want some pattern for what's on the back so players can use knowledge of the front and back of one card to determine the front of another based on its back? You presumably also want some replay value, so unique identifiers on the back would be a problem, right? – Bernhard Barker Sep 15 '20 at 23:39
• Is this a physical board game or a computer board game? The former is likely off-topic here. The line between the two may be blurry, but a computer game can allow for solutions that aren't as easy to accomplish with a physical game. – Bernhard Barker Sep 15 '20 at 23:42
• I think the game mechanical algorithm is universal enough that we can handle it here. Sure, in a digital game we'd usually just make the computer do this selection invisibly, but let's say for the sake of argument that we're making a video game where we want players to act out the setup steps manually. How can we get a correct setup without leaking information about the answer is an interesting game design problem. – DMGregory Sep 15 '20 at 23:50
• @BernhardBarker this is a board game design - will look for a board game forum here. Have often found answers for computer stuff here, so thought I'd try =) Once setup, the cards do not move around - they are either part of the secret recipe, in someone's hands (where they stay the whole game) or face-up and visible to all (where they stay the whole game). As best I can tell, there are 120 correct combinations (5!) out of the 3125 possible combos (5^5). – Chris Backe Sep 16 '20 at 11:12

I think any method with identifying symbols on the backs of the cards is likely to fail.

With just 25 symbols, it would be very easy for players to accidentally memorize a telltale clue of one or more of the cards, spoiling the game for themselves, even if they're actively trying not to notice.

I've seen games that try to obfuscate this information by using fluorescent ink revealed by a UV light, or overlapping patterns you need to look at through a coloured filter, so you only clearly see the pattern at the designated "setup" or "check" time, and can't easily use it to track a card throughout play. But for a mystery game like this, leaking that info at setup time is already enough to spoil the puzzle.

What I'd propose instead is a shuffling approach.

Start by laying out the cards face-up, in a 5x5 matrix, with cards of the same taste all in a row, and cards of the same colour in a column. Let's say it looks like...

AV  AW  AX  AY  AZ
BV  BW  BX  BY  BZ
CV  CW  CX  CY  CZ
DV  DW  DX  DY  DZ
EV  EW  EX  EY  EZ


Turn each card over while keeping it in its place in the matrix. Now the matrix should look like this:

⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜


But the players might still remember which row was which taste, or which column was which colour. So now we'll shuffle them, like a shell game. Slide one row out and move it to one end or the other:

                                         ⬜⬜⬜⬜⬜     ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                                 ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                                 ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜                ⬜⬜⬜⬜⬜    ⬜⬜⬜⬜⬜


Then do the same for a column, and repeat. You can select which row/column to slide each time using a dice roll, rather than leaving it up to the players.

Each time we do one of these shifts, we preserve the fact that each row contains a single taste, and each column contains a single colour, we just switch which one is which in a way that - hopefully, after enough shuffles - your players lose track of.

To make these shuffles easier, you could stack each column into a deck. Then swap the positions of these five decks a few times. Then unpack back to the matrix and stack each row into a deck, and swap the decks around again. You just need to make sure you use the same stacking order in all decks during packing and unpacking (eg. always left-to-right / top-to-bottom). Flipping the order in one deck will make an invalid answer.

Another trick you can use is to have each player take a turn applying a row or column shuffle while the other players are occupied with something else, so no one player can keep track of where every row/column got moved to. This way you can get to complete uncertainty with fewer swaps, where you'd need a higher number to throw off a player with a sharp eye and good memory who can watch the whole process.

After our shuffling, we have a permuted matrix that maybe looks a bit like this, if we looked up from under the glass table:

BX  BW  BY  BV  BZ
DX  DW  DY  DV  DZ
EX  EW  EY  EV  EZ
AX  AW  AY  AV  AZ
CX  CW  CY  CV  CZ


Now your players choose a random card from the matrix to add to the answer, keeping it face-down so no one sees it. Again you could use dice to make this choice. This leaves us with...

BX  BW  BY  BV  BZ   Answer: DW
DX      DY  DV  DZ
EX  EW  EY  EV  EZ
AX  AW  AY  AV  AZ
CX  CW  CY  CV  CZ


Now they remove every card in the incomplete row and column and add them to the deck of clues.

BX      BY  BV  BZ   Answer: DW
Clues:  BW EW AW CW DX DY DV DZ
EX      EY  EV  EZ
AX      AY  AV  AZ
CX      CY  CV  CZ


Slide the remaining cards to return to a square matrix, and repeat:

BX  BY  BV [BZ]    Answer: DW
EX  EY  EV  EZ     Clues:  BW EW AW CW DX DY DV DZ
AX  AY  AV  AZ
CX  CY  CV  CZ

EX  EY  EV    Answer: DW BZ
AX [AY] AV    Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ
CX  CY  CV

EX  EV   Answer: DW BZ AY
CX [CV]  Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ EY CY AX AV

[EX]     Answer: DW BZ AY CV
Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ EY CY AX AV EV CX

Answer: DW BZ AY CV EX
Clues:  BW EW AW CW DX DY DV DZ BX BY BV EZ AZ CZ EY CY AX AV EV CX


This procedure ensures you get exactly one of each flavour and one of each colour in the answer pile, and all the remaining cards in the clue pile.

If you find this runs a bit long, you can also abbreviate it. Once you have a shuffled matrix, just take one diagonal into the answer deck and the rest into the clue deck:

[BX] BW  BY  BV  BZ   Answer: BX DW EY AV CZ
DX [DW] DY  DV  DZ   Clues:  BW BY BV BZ DX DY DV DZ EX EW
EX  EW [EY] EV  EZ           EV EZ AX AW AY AZ CX CW CY CX
AX  AW  AY [AV] AZ
CX  CW  CY  CV [CZ]


If your initial shuffle was enough to mix up your players' memory of which row/column is which, then this is just as good. But you might find randomizing at the end involves easier manipulations than the row/column shuffling, so splitting your randomizing between the two phases might help the setup phase go quicker.

• this is amazing, thanks for this! Will use this as a template and see if it can be made even simpler to setup (obviously this would be trivial for a computer / app, but I'm trying to avoid that for the time being). Other things I've played with involve bar codes (have a peek at 5 Minute Mystery for a published version of the same) or something involving cryptography theory (which goes waaay over my head) where you know something is right but don't know the details... Thanks again. – Chris Backe Sep 16 '20 at 11:53
• You could potentially keep the two traits on opposite sides of the cards. If you keep them all, say, colour-side-up, then you still haven't revealed anything about which colour-flavour pairs were selected. And you can more easily ensure you don't make shuffling errors that way. Look at the cards once to make a pile of each flavour, stacked by colour in the same order. Then all 5 piles look identical, and you can shell-swap them around as much as you like before taking the top card of one, the second card of the next, the third card, fourth, then bottom card of the last pile as your answer. – DMGregory Sep 16 '20 at 12:14