I am having trouble on editing my Latex code to produce a figure (game) using the Tikz package.
I am trying to produce a three players game combining an extensive form (for player 3) and two matrices for player 1 and player 2. Below, I am sending the figure I produced:
The tex code I wrote for producing this game is:
\begin{figure}[!htbp]
\centering
\caption*{Three Players Game: Combining Extensive Form with Matrix Form}\label{hybrid}
\begin{tikzpicture}[scale=1,font=\footnotesize,edge from parent/.style={draw,thick}]
% Two node styles: solid and hollow
\tikzstyle{solid node}=[circle,draw,inner sep=1.2];
\tikzstyle{hollow node}=[circle,draw, inner sep=1.2];
% Specify spacing for each level of the tree
\tikzstyle{level 1}=[level distance=15mm,sibling distance=50mm]
\tikzstyle{level 2}=[level distance=15mm,sibling distance=25mm]
% The Tree
\node(0)[hollow node]{}
child{node{}
edge from parent node[above left]{X}
}
child{node{}
edge from parent node[above right]{Y}
};
% movers
\node[above,circle,inner sep=1,yshift=4]at(0){1};
\node[below]at(0-1){
\gamemathfalse
\arrayrulewidth.75pt
\begin{game}{2}{2}[$P_{1}$][$P_{2}$]
& X & Y\\
X & $1, 1, 1$ & $2, 0, 2$\\
Y & $0, 2, 0$ & $2, 2, 2$
\end{game}
};
\node[below,xshift=-15]at(0-2){
\gamemathfalse
\arrayrulewidth.75pt
\begin{game}{2}{2}[$P_{1}$][$P_{2}$]
& X & Y\\
X & $3, 1, 3$ & $2, 2, 2$\\
Y & $1, 1, 1$ & $1, 3, 1$
\end{game}
};
\end{tikzpicture}
\end{figure}
There are several things I would like to fix in this figure:
-
Instead of the number "1" above the first node, I would like to have "P3" (for Player 3). I tried several things to substitute 1 by P3 such as including "label=above:{P3}" within the code line: "\node(0)[hollow node]{}". But the number 1 is still there.
-
I would like to align the left matrix according to the end of the extensive form tree (similar to the alignment of the right matrix).
-
If possible, I would like to have P3 and the extensive form below the matrix. That is, instead of having first the extensive form and then having it connected to the matrices from top to bottom, I would like to have first the two matrices on the top, and below to it the extensive form (as in the edited figure below).
In sum, this is the Tikz/game/figure I am looking for:
Thanks in advance!
Best Answer
Here are a few examples of your tree in various directions, using the
istgame
package. You can use\setistgrowdirection
or its swap version\setistgrowdirection'
to change the tree growing direction.(I drew the game tables using the
tabu
package, because (as mentioned in the manual) thesgame
package is not compatible with thememoir
class or any other packages that loadarray.sty
.)Added: You can draw the strategic games as you like. For example, if you prefer using the
tabular
environment (totabu
), replace the\def\gameX
and\def\gameY
parts above by the following: