This question is a followup to this question by @Wen1now.
After demonstrating the previous trick, the magician decided to make things a bit harder, discarding some cards so that only eight were left. The trick was much the same as before:
- The assistant started by calling up an audience member. In order to make the trick as impressive as possible, the magician and assistant wanted to be able to call up anyone and have the trick still work; as such, their strategy needed to work even if the audience member knew their strategy and actively worked against them (whilst staying within the rules of the trick).
- The following parts of the trick were done with the magician unable to see (or otherwise gain information about) what was going on:
- The audience member was given 8 cards, numbered from 0 to 7 inclusive. They were asked to arrange them in a single line on the table (so that each of the eight cards was placed in a different one of eight predetermined positions, but the audience member had a free choice of which card went where; in other words, they were choosing a permutation of the cards).
- The assistant selected four of the cards, turning them face down.
- The magician came back, and purely based on the 8 cards that could be seen (the identities and positions of the four face up cards, and the positions of the four face down), identified what the four face down cards must be.
Once the trick started, there was no communication, even indirectly, between the magician and assistant, except via the selection of cards to turn face down. (For example, the cards were symmetrical; there was no way to transmit information based on their orientation.) However, the magician and assistant could talk freely before the trick started, and had agreed a strategy: the assistant would select cards to turn face-down in such a way that the magician would uniquely be able to reconstruct the original permutation knowing only the identities and positions of the four face up cards. In other words, this is a purely mathematical trick, rather than involving sleight of hand or anything like that.
(Here's an equivalent formulation for the mathematicians and computer scientists out there: write a function whose input is a permutation of the list
[0, 1, 2, 3, 4, 5, 6, 7], and whose output is equal to the input except that four of the elements are replaced with
"?", such that different inputs map to different outputs.)
There's one other restriction that the magician and assistant were working under: they wouldn't be able to take pages of notes with them when performing the trick, so whatever their strategies were, they would have to be simple enough to memorise; listing a separate strategy for each of the 40320 possible inputs isn't a reasonable answer here.
What strategy could the magician and assistant have used?