更改游戏树中起始节点的位置

更改游戏树中起始节点的位置

我想改变玩家 3 和下方节点的位置,使展开线分别直接结束在玩家 1 和玩家 2 上方的中间。有人有快速解决方案吗?抱歉,我是新手,我不知道该怎么做才能编译以下代码,但它在 Latex 中有效。

\documentclass[12pt]{article}
\usepackage{forest}
\usepackage{tikz}
\begin{document}
\begin{figure}[!htbp]
    \centering
    \begin{tikzpicture}[scale=1.5]
    \tikzstyle{solid node}=[circle,draw,inner sep=1.2];
    \tikzstyle{hollow node}=[circle,draw, inner sep=1.2];
    \tikzstyle{level 1}=[level distance=1cm,sibling distance=6cm]
    \tikzstyle{level 2}=[level distance=1cm,sibling distance=4cm]
    \node(0)[hollow node]{}
    child{node{}
        edge from parent node[above left]{C}
    }
    child{node{}
        edge from parent node[above right]{D}
    };
    \node[circle, label=above:{Player 3}]at(0){};
    \node[below]at(0-1){
        \arrayrulewidth.75pt
        \begin{tabular}{l|c|c|c|}
        \multicolumn{2}{c}{}   & \multicolumn{2}{c}{\textit{Player 2}} \\
        \cline{2-4}
        &  & $A$ & $B$ \\
        \cline{2-4}
        & $A$ & \makebox[1.8cm][s]{ $2$ , $2$ , $3$ }   & \makebox[1.8cm][s]{ $0$ , $4$ , $1$ }  \\
        \cline{2-4}
        \raisebox{1.5ex}[-1.5ex]{\textit{Player 1}} & $B$ & \makebox[1.8cm][s]{ $4$ , $0$ , $2$ } & \makebox[1.8cm][s]{ $1$ , $1$ , $4$ } \\
        \cline{2-4}
        \end{tabular}
    };
    \node[below,xshift=-15]at(0-2){
        \arrayrulewidth.75pt
        \begin{tabular}{l|c|c|c|}
        \multicolumn{2}{c}{}   & \multicolumn{2}{c}{\textit{Player 2}} \\
        \cline{2-4}
        &  & $A$ & $B$ \\
        \cline{2-4}
        & $A$ & \makebox[1.8cm][s]{ $2$ , $2$ , $3$ }   & \makebox[1.8cm][s]{ $0$ , $4$ , $1$ }  \\
        \cline{2-4}
        \raisebox{1.5ex}[-1.5ex]{\textit{Player 1}} & $B$ & \makebox[1.8cm][s]{ $4$ , $0$ , $2$ } & \makebox[1.8cm][s]{ $1$ , $1$ , $4$ } \\
        \cline{2-4}
        \end{tabular}
    };
    \end{tikzpicture}
\end{figure}
 \end{document}

答案1

使用istgame包,你可以这样做:

在此处输入图片描述

\documentclass{standalone}

\usepackage{istgame}

\def\gameC{%
        \arrayrulewidth.75pt
        \begin{tabular}{l|c|c|c|}
        \multicolumn{2}{c}{}   & \multicolumn{2}{c}{\textit{Player 2}} \\
        \cline{2-4}
        &  & $A$ & $B$ \\
        \cline{2-4}
        & $A$ & \makebox[1.8cm][s]{ $2$ , $2$ , $3$ }   
              & \makebox[1.8cm][s]{ $0$ , $4$ , $1$ }  \\
        \cline{2-4}
        \raisebox{1.5ex}[-1.5ex]{\textit{Player 1}} 
        & $B$ & \makebox[1.8cm][s]{ $4$ , $0$ , $2$ } 
              & \makebox[1.8cm][s]{ $1$ , $1$ , $4$ } \\
        \cline{2-4}
        \end{tabular}
}
\def\gameD{%
        \arrayrulewidth.75pt
        \begin{tabular}{l|c|c|c|}
        \multicolumn{2}{c}{}   & \multicolumn{2}{c}{\textit{Player 2}} \\
        \cline{2-4}
        &  & $A$ & $B$ \\
        \cline{2-4}
        & $A$ & \makebox[1.8cm][s]{ $2$ , $2$ , $3$ }   
              & \makebox[1.8cm][s]{ $0$ , $4$ , $1$ }  \\
        \cline{2-4}
        \raisebox{1.5ex}[-1.5ex]{\textit{Player 1}} 
        & $B$ & \makebox[1.8cm][s]{ $4$ , $0$ , $2$ } 
              & \makebox[1.8cm][s]{ $1$ , $1$ , $4$ } \\
        \cline{2-4}
        \end{tabular}
}

\begin{document}

\begin{istgame}[scale=1.5]
\xtdistance{10mm}{60mm}
\istroot(0)[initial node]{Player 3}
  \istb{C}[al]{\gameC}[below,xshift=-12mm]
  \istb{D}[ar]{\gameD}[below,xshift=-12mm]
  \endist
\end{istgame}

\end{document}

相关内容