To make an implementation of this variance of sleuth first all the rules need to be specified. For the formal description of the cards in the model we use the following notation xCy where x ∈(1,2,3,H,O) represent player 1..3, Hidden and Open, C ∈(R,G,B) represent the 3 colours Red, Green and Blue and lastly y ∈(1,2,3) represents the amount of diamonds on the card.
There are two different Search cards:
These 2 types of question cards can be formally defined as:
The knowledge that each agent knows can be formalized into a kripke model. Before any card is dealt all the combinations of the 9 cards are possible. This means that before any card is dealt there are x different worlds that can be the true world. Next the cards are being dealt and each player sees his own cards and the card that is shown to everybody, Each player updates his model, meaning that every relation to worlds that are not epistemic alternatives anymore are deleted. Worlds that are not epistemic alternatives for an agent are all the worlds that become impossible for an agent with the cards that the player holds. e.g. let's say that agent i sees that she has the green card with 1 diamond. Now all the worlds where agent i does not have the green card with 1 diamond become impossible and the relations are deleted.
As described above there are 2 types of questions. The question about how many cards of a certain color an agent has removes every relation to worlds where the amount of cards of a color does not correspond with the number told. If agent i utters that she has 2 red cards then all agents update their model by deleting all relations to worlds where agent i doesn't have 2 red cards. Since these worlds are no longer an epistemic alternative for any of the agents the world can also be removed from the model. The second question, asking whether an agent has a specific card works similarly, deleting all the relations to worlds where agent i doesn't have this specific card are deleted. If the agent tells that he doesn't have this specific card then all the worlds where the agent has this card are deleted.
In order to find the hidden card the players do not have to know each card every player has. When an agent only has relations to epistemic alternatives where the hidden card is the same the agent knows enough to tell which card is hidden. The program gives some hints for a player which card could be picked best. In other words, which question should be asked to delete as many relations possible with different hidden cards. Below is an example of a game played.
In this situation player 1 has 2 blue cards, 1 with 2 diamonds and 1 with 3 diamonds. Player 1 has asked 1 question so far, namely how many green cards player 2 has. Then both player 2 and player 3 have asked a question and now it is player1's turn again. At the bottom the suggestions for which question to play are shown. Take for example the question "Do you have the green with 1 diamond card?" question, the left one. Since player 1 asked to player 2 how many green cards he has, for which the response was 0, it makes no sense asking this to player 2. You can see that from the red cells with the text "No sense" and "Impossible.". As a general strategy it is best to always pick the cards with the highest probability (so with the higher values).