Abstract
We provide Bayesian decision support for revealing the identity of opponents in the board game Inkognito. This includes the use of combinatorics to deduce the likelihood of observing a particular configuration and a sequential Bayesian belief updating scheme to infer opponent's identity. From a R point of view we use base R where it's best: manipulating matrices and supplement this with modern dplyr style manipulation of data frames and magrittr pipes for sequential belief updating.
Image from boardgamegeek.com by yzemaze available under a CC BY-NC-SA 3.0 license.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. The markdown+Rknitr source code of this blog is available under a GNU General Public License (GPL v3) license from github.
Introduction
Inkognito is a board game for four players first published in 1988. Each player has a secret identity (either Lord Fiddlebottom, Madame Zsa Zsa, Col. Bubble or Agent X) and moves four figures around the game board (a tall, a short, a fat, and a thin figure). However, only one of the figures (the player's so called build type) is the player, the other three are smokescreen, i.e. friendly spies serving to confuse the other players. As part of the game one has to learn the identity and build of the other players in order to solve a mission goal. To this end the players move on the board, whenever one of the four figures meets one of the figures of an opponent, the opponent has to reveal information about their identity and build. There is a further neutral character, the so called ambassador, which can be moved by all players. There are two types of revelations depending on which figures meet:
Player question: The player can decide to ask the opponent about either identity or build. If the question is about the identity the player has to state two (of the four) identities and one (of the four) builds. At least one of the three statements has to be correct, for example, if the opponent is Agent X and has the thin figure, then the statement could be: I'm Lord Fiddlebottom or Madame Zsa Zsa and have the thing figure. Conversely, if the question is build then two builds and one identity is stated -- again at least one of the statements has to be true.
Ambassador question about either identity or build: If about identity the opponent has to state two identities, one of them has to be correct. Similarly if the question is about build.
The information arising from each question is logged on a so called worksheet as shown below. The picture shows the logged information a game where the player asked one opponent (the red figure) a total of three questions (two player questions and one ambassador question).
The idea is to sequentially guide your questioning in order to reveal the identity of the other players and their build. For a more detailed description of the game see this review or this even longer review. In what follows, we shall be less interested in all the particularities of the game and focus on the sequential belief update of identity and build from the questions, which is central part of the game.
Statistical Approach to the Belief Updating
We cast the questioning into mathematical notation as follows. Let \(I\in \{1,2,3,4\}\) be the opponent's identity and \(B=\{1,2,3,4\}\) the opponent's build. Let
\[
D_k=(I_{k,1},I_{k,2},I_{k,3},I_{k,4},B_{k,1},B_{k,2},B_{k,3},B_{k,4})'
\]
be the information the opponent offers the \(k\)'th time the person is asked about the identity. Here, \(I_{k,j}\) is an indicator variable showing whether in the \(k\)'th question the opponent claims to have identity \(j\). Furthermore, \(B_{k,j}\) is an indicator variable showing whether the opponent in the \(k\)'th question claims to have aspect \(j\). Altogether \(D_k\) corresponds to one row of information in the worksheet. In what follows we address the two types of questions, the resulting likelihoods and how a Bayesian framework can be used to update the belief about the opponent's identity and build.
Player question about identity or aspect
A player question consists of asking the opponent about either their identity or build. In response the opponent has to provide 3 pieces of information: if asked about the identity two of the statements have to concern the identity and one the build. Similarly, if asked about the build, one identity and two build statements have to be given. In other words, if the question is about identity, the vector \(D_k\) has to be such that \(\sum_{j=1}^4 I_{k,j} = 2\) and \(\sum_{c=1}^4 B_{k,c} = 1\). Furthermore, at least one of the three statements provided needs to be true, i.e. if the opponent has identity \(i\) and build \(b\), then the provided information has to be such that
\[
\begin{align*}
\sum_{j=1}^4 I(I=i) I_{k,j} + \sum_{c=1}^4 I(B=b) B_{k,c}
\geq 1 &amp;\Leftrightarrow I_{k,i} + B_{k,b} \geq 1.
\end{align*}
\]
Ambassador question
If instead a player moves the ambassador on the same location as another player's figure, then one can -- as before -- inquire about the other player's identity or build. However, when the ambassador asks one has to provide two statements about the inquired aspect -- of which one has to be true. In other words, the answer to an ambassador question \(D_k\) will be such that the sum over either the identity indicators or the builds equal 2. Furthermore, again assuming that the opponent's true identity is \(i\) and true build is \(b\) we must have
\[
I_{k,i} + B_{k,b} = 1,
\]
because the answer will either be to identity or build.
Implementation in R
We implement the possible configurations \(D_k\) on the worksheet as a matrix. Base R code does this very effectively:
##Factor levels of identities and builds
identities |\__D_k) &amp;= \frac{P(D_k|\__I=i,B=b)P(I=i,B=b)}{P(D_k)} \\
&amp;=
\frac{P(D_k|\__ I=i,B=b)P(I=i,B=b)}{\sum_{j=1}^4 \sum_{c=1}^4 P(D_k|\__
I=j,B=c)P(I=j,B=c)}.
\end{align*}
\] In code:
#############################################################
## Function for sequentially updating the state information
############################################################
update