Cluedo
Group 4
Edan Harel, Lyubov Golub, Andy Shin


Logic

X's and O's  

We keep the equivalent of a 2D array to keep track of information we find. When we learn that a player does not have a card, we put an X into that position in the array. Likewise, we note an O when we learn that a player has a card.

Turn 1:
Play\Card      1       2       3       4       5       6       7       8
Player 1       O                              X       X       
Player 2       X                              X       X       X       X
Me             X       X       X       X       O       O       X       X
Hid Cards      X                              X       X

We learn that Player 1 has Card 2. Now we can X out all other players for card 2:

Turn 2:
Play\Card      1       2       3       4       5       6       7       8
Player 1       O       O       X       X       X       X       X       X
Player 2       X       X                      X       X       X       X
Me             X       X       X       X       O       O       X       X
Hid Cards      X       X                      X       X

Then, we deduce what player 2 holds, because the number of unknowns = the number of cards he holds:

 
Turn 2:
Play\Card      1       2       3       4       5       6       7       8
Player 1       O       O       X       X       X       X       X       X
Player 2       X       X       O       O       X       X       X       X
Me             X       X       X       X       O       O       X       X
Hid Cards      X       X       X       X       X       X

Logic Boxes

For each player we keep a set of "logic boxes" or disjunctions. Each turn we look through the history and take notes on our opponents' interrogations. Each time a player answers "Yes," we add a list of cards to his profile representing a disjunction. If a player answers "no," we record that this player does not have any of the requested cards. For example, if Player 1 is asked about cards 1,2,3 we would add the disjunction 1 V 2 V 3. Before adding any disjunction we check whether it is a superset or subset of a previously added disjunction. If so, we remove the superset from the list. Before our program handled supersets correctly our player would halt on some moves, leading our colleagues in the class to complain loudly to us while testing their code.

We implemented one other logic rule that allows us to narrow down hidden card possibilities. If two players have the same disjunction of size 2, neither of the cards can be a hidden card. The same is true for three players having the same disjunction of size 3, and so on.

We have learned that Player 1 and player 2 both have 1 V 2 (an identical disjunction of the same length).

 
               1       2       3       4       5
Player1                X       X       
Player2                X       X       
Player3                        
Me             X       X       O       X       X
Hid                    X

We know each player must have at least one card from the disjunction, but we don't know who has which. However, we know neither card is in the hidden deck, and we randomly choose the location of each card among the two players (since the exact location is not important to us) So we choose, say, that player 1 has card 1, and 2 holds 2. We are one step closer to finding the hidden cards.

 
               1       2       3       4       5
Player1        O       X       X       X       X       
Player2        X       O       X       X       X
Player3        X       X              
Me             X       X       O       X       X
Hid            X       X       X

Questioning

We considered two strategies for choosing which player to interrogate. The first strategy learns as much information as possible about one player before moving on to the next. The second strategy attempts to gain an approximately equal amount of information about all players. We chose the latter strategy because we feel it minimizes the information our questions reveal to our opponents while gaining the same amount of information as finishing off one player at a time. 

In order to formulate the question, we start off by taking the list of all cards and then eliminate those cards we do not want to ask. The first cards we eliminate are all the cards we already know that player has, to ensure that we learn new information. Then we count the number of cards the player holds that are still unknown to us. We randomly throw out cards so that we have removed one less than this number. This assures us that the response will be a yes, but also provides reverse padding in order to confuse the other players. We want them to think that some of the cards we haven't asked about are either in our hands, or that we know someone is holding these cards. Thereby, if someone is trying to deduce the hidden cards strictly by looking at which card has been asked the most, we reduce the accuracy of their strategy, since there is some chance that we threw out a card that was, in fact, a hidden card.

Finally, we throw out one or more cards that is known to us. There were a couple of choices we considered, from removing the card that we have most revealed to other players (possibly making them think that the cards we hold we don't ask about, possibly confusing them into thinking we hold cards in our hand that we randomly removed in the previous step), to randomly choosing a number of known cards from the question list, thereby confusing any player trying to determine a possible meaning from our questions. We chose the first. Thus, after removing the cards we know about, removing a number of random cards we don't know about (such that we are still assured of a yes response), we then pose the question to the player and fill the appropriate logic boxes based on the response.


Answering

In answering a player's interrogation, it is most important to give away the least amount of information. Our approach to answering a player intelligently is two-fold. First, if a player asks for a set of cards that contains a card that we've revealed to him already we reveal the same card to the player. Secondly, when a player asks for a set of cards, which contains a card that we hold, we reveal to him the card that we've most frequently revealed to other players. This ensures that we do not reveal any new information to the domain of players, and prolongs the secrecy of our cards. By revealing the card that we've most frequently revealed, it balances the information that players have about our cards. In the larger scheme of things, if the domain of players know about the same cards, it equalizes any advantages players may have and stabilizes the pace of the game. Since we gain no new knowledge when interrogated, we wish to minimize the information revealed to the domain of players, prolonging the game and allowing us (and other players) more turns to obtain information.


Early Guessing

Triangulation strategy

The strategy for early guessing is dependent on the assumption that cards that had been hidden would be asked about more frequently and in a more dispersed pattern than non-hidden cards. Our theory is that the only thing we could rely on, in terms of other people's questionings, was that no player would purposefully question another player using cards that he knew that player had, as that would give the first player no new information, and thereby waste the turn for them. While there is some possibility that the player may be attempting to spoof the other players, this seems unlikely, as it would be forced to rely on the other players purposefully chasing. This in turn would result in a very crucial loss of turn should the player be wrong in his reliance, since that player would be one step behind when everyone else has learned enough to formulate a guess.

Now, working from this theory, we assume that a card whose state is known would be less likely to be asked in the future - while some known cards can be padded to confuse other players, cards one knows that the interogatee has won't be included, and even when padding. One doesn't want to include all the cards one knows about, otherwise other players can deduce that the card that was asked in the previous turn, but not asked in the following turn is the card the player learned about. And, while some players may follow certain strategies to randomly discard unknown cards, while assuring that they get a yes answer, or even without trying to assure a yes answer, the likelihood that this is done across a number of players, given what could be unproductive results, seems low.

Our strategy tries to try to determine which cards are being asked by the most diverse number of people. Thus, we care more about a card being asked by 5 different players than a card being asked 5 times by one player. If one person were to use a specific strategy to counteract us our strategy is still effective because it relies on all of the players' interrogations. 

In order to determine which cards are being asked the most and how diverse the questioning is, we create two two-dimension arrays - one containing the information of who is asking which card how many times, and the other containing the information of who is being asked about which card, and how many times. Each time a card is asked, we increase the cell in both of the arrays by a certain amount dependant on whether the answer was yes or no (since a no response makes it more likely that the card is hidden). During implementation we found that the numbers in the cells would get so large they would exceed the maximum integer values. A solution to this problem was halving each cell each turn, resulting in later questions being weighed more heavily. Later questioning is in fact more relevant, because by then the interrogatee's cards have been narrowed down and it is harder to question with a select number of unknown cards and guarantee a yes response. 

Determining Cards Most Diversely Asked



n = current turn number 
Xi is dependent on answer on turn i 
    3 for no     2 for yes    0 if not included in question

Most Wanted Cards

Card Number

The cards circled purple are the most diversely asked cards as determined by our program. The dark blue horizontal line represents the threshold we used to determine which of the cards are hidden. The cards circled in blue are the actual hidden cards. In this example, two of the cards most diversely asked are hidden, and one is not.

When a significant portion of the game has passed, each turn we start to determine how widely a card has been asked by multiplying the card cells of both arrays together to create two arrays that tell us how frequently and how diverse the questioning of a card is. One array determines this by who asked about that card, and the other by who was asked about that card. We take a look at the numHiddenCard highest cards on each of the two arrays, ignoring any card that we have already determined to be in some players hands. We compare these top sets of numbers from the two arrays. If they are the same, this puts us a step closer to having trust that these cards are, in fact, the hidden deck.


 

Possible Hidden Card Lists, Turn 1

Cards asked of the most diverse number of players

8

10

12

15

Cards asked by the most diverse number of players

13

12

10

8

Let's say that during turn 1, we learned where the 13 is. The lists now look like this:

Possible Hidden Card Lists, Turn 2

Cards asked of the most diverse number of players

8

10

12

15

Cards asked by the most diverse number of players

12

10

8

11

We see that the top three numbers match. If we find that these numbers stay in the top positions for the next few turns, they are probably the hidden cards.

As the game approaches the end, we have more trust in this list of possibly hidden cards. We have more information to work with, the new questions give more accurate information, and we have found cards that are definitely not hidden, thus allowing us to eliminate those cards from the arrays. We are not better able to pinpoint the hidden cards from the examining the arrays and are less likely to make a mistake. Thus, in order to determine whether or not it is worth guessing when the two lists match, we wait a certain number of turns before guessing - dependant on how far into the game we are - and ascertain if our choices for hidden cards have not changed. If the two arrays match for enough turns, we guess early. As the number of cards we have knowledge about grows, the number of turns we wait before guessing shrinks down. Should the lists should not match, or for not enough turns, as is often the case with 16 card games, we guess once we have achieved perfect knowledge.

One flaw that we discovered after implementing is that there was a certain not naive nor counter-productive method of questioning that does manage to spoof us. This method hides one card more than any of the others - so that it would be the last card that everyone learned about when interrogating you - and then pads that card in all of the players' questions. In this method, assuming we did not figure out where that card was via questioning or deductions, that card would appear prominently on our list, as everyone would be asking about that card.

We were developing two counter-strategies for this. One was to base our questions on what numbers appeared in the two lists (and possibly some of the cards that had just missed the cut) and asking those to all the players, and when finding a player who answered yes, we would repeat the questions while removing a card until he said no, since frequently, it would be the same one or two players who implemented this strategy and would have two or three cards showing up in the final cards. However, this relied on too many assumptions for us.

Another approach uses the idea that rather than try to decide which cards are in the deck, wait until halfway through the game and then look for what cards had been asked the least (but most diversely so), and decide that those cards were not in the hidden pile. This strategy seemed to work, and we never witnessed an incident when such a card was a hidden card, however frequently these were cards we had already knew about, and usually, this would not give us enough information to give us a significant advantage.

However, if we change our method of picking who to ask, moving from interrogating whoever we knew the least about, and instead, question one person until we have complete knowledge, and then move on to the next player, the second approach could become a useful tool. Once half of the game has completed, we have complete knowledge of half of the players and can use the knowledge of which cards have been asked the least to determine which cards are not in the deck - which are most likely the earliest cards given up by the players that we haven't yet interviewed, and eliminate them from our questioning. At this point, we would probably change our questioning strategy to interrogate players we know the least about. We'll never have complete knowledge of a player since we've eliminated some of the cards from our questions that he may hold. With this in play, we can reach a state of perfect knowledge of the hidden cards earlier. Unfortunately, we came up with this strategy far too late to implement it.


 

Least Wanted Cards


Card Number
Above, every card whose cell value is below the threshold line is chosen as card not hidden.

 

Using Cards Least Frequently Asked

 

C1

C2

C3

C4

P1

D

D

 

 

P2

D

D

 

 

P3

D

D

D

D

P4

D

D

D

D

Me

 

 

 

 

The above figure shows a 4 player, 4 cards per player game where we question each player until we know all of his cards. The colored boxes show cards deduced from interrogations. The X's mark cards that were deduced from other players' questions. 


Tournament Results

We had very similar results for various numbers of players. We ranked low for 1 card per player games, very high for 2-3 card per player games, mid-rank for 5-8 cards, and low again for 16 cards. Our low ranks for 16 card per player games can be explained by that fact that there are more cards players can hide from us. Spoofing our strategy works best with more cards per player. In addition, our strategy for guessing early was optimized and tested for less cards. Our player works better with more hidden cards because the hidden cards are almost certain to be asked more frequently. 


Acknowledgements

We would like to thank David Vespe from Group 7, with whom Edan discussed various strategies for the problem.

Thanks to our colleagues who, while doing their own testing, told us about bugs they saw in our program.