如何设计一棵树上的游戏?

如何设计一棵树上的游戏?

有人能帮我设计一个类似下面的游戏吗?

项目清单

这些包含属于每个玩家的顶点的椭圆体是否描绘了信息结构?我以为它们是用虚线设计的

答案1

使用游戏包裹:

树结构1

在此处输入图片描述

\begin{istgame}[xscale=.7,font=\scriptsize]
%% root
\xtdistance{20mm}{32mm}
\istroot(0)[chance node]{0}
  \istb  \istb<level distance=25mm>
  \istb  \istb<level distance=25mm>
  \endist
%% player I
\xtdistance{20mm}{16mm}
\istroot(1a)(0-1)  \istb  \istb  \endist
\xtdistance{15mm}{16mm}
\istroot(1b)(0-2)  \istb  \istb  \endist
\xtdistance{20mm}{16mm}
\istroot(1c)(0-3)  \istb  \istb  \endist
\xtdistance{15mm}{16mm}
\istroot(1d)(0-4)  \istb  \istb  \endist
%% player II
\xtdistance{15mm}{8mm}
\istroot(2Aa)(1a-1)  \istb  \istb  \endist
\istroot(2Ab)(1a-2)  \istb  \istb  \endist
\istroot(2Ac)(1b-1)  \istb  \istb  \endist
\istroot(2Ad)(1b-2)  \istb  \istb  \endist
\istroot(2Ba)(1c-1)  \istb  \istb  \endist
\istroot(2Bb)(1c-2)  \istb  \istb  \endist
\istroot(2Bc)(1d-1)  \istb  \istb  \endist
\istroot(2Bd)(1d-2)  \istb  \istb  \endist
%% (oval) information sets
\xtInfosetO(0)(0)
\xtInfosetO(1a)(1c){I}[xshift=-2em]
\xtInfosetO(1b)(1d){I}[xshift=3em]
\xtInfosetO(2Aa)(2Ad){II}
\xtInfosetO(2Ba)(2Bd){II}
\end{istgame}

树结构2

在此处输入图片描述

\begin{istgame}[xscale=.7,font=\scriptsize]
%% root
\xtdistance{20mm}{32mm}
\istroot(0)[chance node]{0}  \istb  \istb  \istb  \istb  \endist
%% player I
\xtdistance{15mm}{16mm}
\istroot(1a)(0-1)  \istb  \istb  \endist
% \xtdistance{15mm}{16mm}
\istroot(1b)(0-2)  \istb  \istb  \endist
% \xtdistance{15mm}{16mm}
\istroot(1c)(0-3)  \istb  \istb  \endist
% \xtdistance{15mm}{16mm}
\istroot(1d)(0-4)  \istb  \istb  \endist
%% player II
\xtdistance{15mm}{8mm}
\istroot(2Aa)(1a-1)  \istb  \istb  \endist
\istroot(2Ab)(1a-2)  \istb  \istb  \endist
\istroot(2Ac)(1b-1)  \istb  \istb  \endist
\istroot(2Ad)(1b-2)  \istb  \istb  \endist
\istroot(2Ba)(1c-1)  \istb  \istb  \endist
\istroot(2Bb)(1c-2)  \istb  \istb  \endist
\istroot(2Bc)(1d-1)  \istb  \istb  \endist
\istroot(2Bd)(1d-2)  \istb  \istb  \endist
%% (various) information sets
\xtInfosetO(0)(0)
\xtCInfosetO(1a)(1c)<1.2>{I}
\xtCInfoset(1b)!.65!(1d)<1.15>{I}
\xtInfosetO[solid](2Aa)(2Ad){II}
\xtInfoset[densely dashed](2Ba)(2Bd){II}
\end{istgame}

带有完整代码的游戏树

在此处输入图片描述

您可以使用\setistgrowdirection'{east}将游戏树的方向更改为东。

\documentclass[tikz]{standalone}
    
\usepackage{istgame}

\begin{document}

\begin{istgame}[font=\scriptsize]
\setistgrowdirection'{east}
%% root
\xtdistance{20mm}{32mm}
\istroot(0)[chance node]{0}
  \istb  \istb  \istb  \istb  \endist
%% extending branches
\istroot(0a)(0-1)[null node]
  \istb{\frac13(TL)}[above,near start] \endist
\istroot(0b)(0-2)[null node]
  \istb{\frac13(BL)}[above,near start] \endist
\istroot(0c)(0-3)[null node]
  \istb{\frac13(TR)}[below,near start] \endist
\istroot(0d)(0-4)[null node]
  \istb{0(BR)}[below,near start] \endist
% \xtShowEndPoints
%% player I
\xtdistance{15mm}{16mm}
\istroot(1a)(0a-1)
  \istb{T_1}[a]  \istb{B_1}[b]  \endist
\istroot(1b)(0b-1)
  \istb{T_2}[a]  \istb{B_2}[b]  \endist
\istroot(1c)(0c-1)
  \istb{T_1}[a]  \istb{B_1}[b]  \endist
\istroot(1d)(0d-1)
  \istb{T_2}[a]  \istb{B_2}[b]  \endist
\xtdistance{15mm}{8mm}
%% player II
\istroot(2Aa)(1a-1)
  \istb{L_1}[a]{6,6}  \istb{R_1}[b]{2,7}  \endist
\istroot(2Ab)(1a-2)
  \istb{L_1}[a]{7,2}  \istb{R_1}[b]{0,0}  \endist
\istroot(2Ac)(1b-1)
  \istb{L_1}[a]{6,6}  \istb{R_1}[b]{2,7}  \endist
\istroot(2Ad)(1b-2)
  \istb{L_1}[a]{7,2}  \istb{R_1}[b]{0,0}  \endist
\istroot(2Ba)(1c-1)
  \istb{L_2}[a]{6,6}  \istb{R_2}[b]{2,7}  \endist
\istroot(2Bb)(1c-2)
  \istb{L_2}[a]{7,2}  \istb{R_2}[b]{0,0}  \endist
\istroot(2Bc)(1d-1)
  \istb{L_2}[a]{6,6}  \istb{R_2}[b]{2,7}  \endist
\istroot(2Bd)(1d-2)
  \istb{L_2}[a]{7,2}  \istb{R_2}[b]{0,0}  \endist
% information sets
\xtInfosetO(0)(0)
\xtCInfosetO[fill=red!20,fill opacity=.3](1a)!.4!(1c)<1.2>{I}
\xtCInfosetO[fill=blue!20,fill opacity=.3](1b)!.6!(1d)<1.15>{I}
\xtInfosetO(2Aa)(2Ad){II}
\xtInfosetO(2Ba)(2Bd){II}

\end{istgame}

\end{document}

答案2

使用 TiZ 树:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{fit, shapes.geometric}

\begin{document}

\tikzset{
  grow'=right,
  level 1/.style={sibling distance=2cm},
  level 2/.style={level distance=2cm},
  level 3/.style={sibling distance=1cm},
  level 4/.style={sibling distance=.5cm},
  short/.style={level distance=1cm},
  long/.style={level distance=3cm},
  reset/.style={level distance=2cm},
  solid/.style={circle, fill, inner sep=1pt},
  vertice/.style={ellipse, draw, dashed, inner xsep=5px, inner ysep=-7.5pt}
}

\begin{tikzpicture}
    \node[circle, draw] {$0$}
        child[parent anchor=east] { 
            child { node[solid] (a1) {} 
                child { node[solid] (b1) {} 
                    child { node[solid, label={0:$(6,6)$}] {} 
                    edge from parent node[pos=.7, above] {$L_1$} }
                    child { node[solid, label={0:$(2,7)$}] {} 
                    edge from parent node[pos=.7, below] {$R_1$} }
                edge from parent node[above] {$T_1$}
                }
                child { node[solid] (b2) {} 
                    child { node[solid, label={0:$(7,2)$}] {} 
                    edge from parent node[pos=.4, above] {$L_1$} }
                    child { node[solid, label={0:$(0,0)$}] {} 
                    edge from parent node[pos=.4, below] {$R_1$} }
                edge from parent node[below] {$B_1$}
                }
            }
        node[label={90:$\frac{1}{3}(TL)$}] {}
        }
        child[parent anchor=east] {
            child[short] { node[solid] (a2) {}
                child[long] { node[solid] (b3) {} 
                    child[reset] { node[solid, label={0:$(6,6)$}] {} 
                    edge from parent node[pos=.7, above] {$L_1$} }
                    child[reset] { node[solid, label={0:$(2,7)$}] {} 
                    edge from parent node[pos=.7, below] {$R_1$} }
                edge from parent node[pos=.67, above] {$T_2$}
                }
                child[long] { node[solid] (b4) {} 
                    child[reset] { node[solid, label={0:$(7,2)$}] {} 
                    edge from parent node[pos=.4, above] {$L_1$} }
                    child[reset] { node[solid, label={0:$(0,0)$}] {} 
                    edge from parent node[pos=.4, below] {$R_1$} }
                edge from parent node[pos=.67, below] {$B_2$}
                }
            }
        node[label={90:$\frac{1}{3}(BL)$}] {}
        }
        child[parent anchor=east] { 
            child { node[solid] (a3) {}
                child { node[solid] (b5) {} 
                    child { node[solid, label={0:$(6,6)$}] {} 
                    edge from parent node[pos=.7, above] {$L_2$} }
                    child { node[solid, label={0:$(2,7)$}] {}
                    edge from parent node[pos=.7, below] {$R_2$} }
                edge from parent node[above] {$T_1$}
                }
                child { node[solid] (b6) {} 
                    child { node[solid, label={0:$(7,2)$}] {} 
                    edge from parent node[pos=.4, above] {$L_2$} }
                    child { node[solid, label={0:$(0,0)$}] {} 
                    edge from parent node[pos=.4, below] {$R_2$} }
                edge from parent node[below] {$B_1$}
                }
            }
        node[label={-90:$\frac{1}{3}(TR)$}] {}
        }
        child[parent anchor=east] { 
            child[short] { node[solid] (a4) {}
                child[long] { node[solid] (b7) {} 
                    child[reset] { node[solid, label={0:$(6,6)$}] {} 
                    edge from parent node[pos=.7, above] {$L_2$} }
                    child[reset] { node[solid, label={0:$(2,7)$}] {}
                    edge from parent node[pos=.7, below] {$R_2$} }
                edge from parent node[pos=.67, above] {$T_2$}
                }
                child[long] { node[solid] (b8) {} 
                    child[reset] { node[solid, label={0:$(7,2)$}] {} 
                    edge from parent node[pos=.4, above] {$L_2$} }
                    child[reset] { node[solid, label={0:$(0,0)$}] {} 
                    edge from parent node[pos=.4, below] {$R_2$} }
                edge from parent node[pos=.67, below] {$B_2$}
                }
            }
        node[label={-90:$0(BR)$}] {}
        };
        
        \node[vertice, fit=(a1) (a3)] (v1) {};
        \node at ([yshift=1cm]v1) {I};
        \node[vertice, fit=(a2) (a4)] (v2) {};
        \node at ([yshift=-1cm]v2) {I};

        \node[vertice, fit=(b1) (b4)] (v3) {};
        \node at (v3) {II};
        \node[vertice, fit=(b5) (b8)] (v4) {};
        \node at (v4) {II};

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容