From 3e868961dcbbe4a5ef7f395e1d9cb824100e0046 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 28 Jan 2019 22:03:56 +0000 Subject: istgame (28jan19) git-svn-id: svn://tug.org/texlive/trunk@49848 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/istgame/README.txt | 26 +- .../doc/latex/istgame/istgame-doc-v1.0.tex | 3327 --------- .../doc/latex/istgame/istgame-doc-v2.0.tex | 7464 ++++++++++++++++++++ .../texmf-dist/doc/latex/istgame/istgame-doc.pdf | Bin 364222 -> 707432 bytes .../texmf-dist/doc/latex/istgame/istgame-doc.tex | 119 +- Master/texmf-dist/doc/latex/istgame/istgame.ist | 2 +- 6 files changed, 7557 insertions(+), 3381 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/istgame/istgame-doc-v1.0.tex create mode 100644 Master/texmf-dist/doc/latex/istgame/istgame-doc-v2.0.tex (limited to 'Master/texmf-dist/doc/latex/istgame') diff --git a/Master/texmf-dist/doc/latex/istgame/README.txt b/Master/texmf-dist/doc/latex/istgame/README.txt index e802d590109..38155f274a2 100644 --- a/Master/texmf-dist/doc/latex/istgame/README.txt +++ b/Master/texmf-dist/doc/latex/istgame/README.txt @@ -1,31 +1,31 @@ istgame.sty: Drawing Game Trees with TikZ -===================================== +========================================= Author: In-Sung Cho -Introduction: +Introduction: -This is a LaTeX package that provides macros based on TikZ to draw a game tree. -The main idea underlying the core macros here is the completion of a whole tree -by using a sequence of simple ‘parent-child’ tree structures, -with no longer nested relations involved +This is a LaTeX package that provides macros based on TikZ to draw a game tree. +The main idea underlying the core macros here is the completion of a whole tree +by using a sequence of simple 'parent-child' tree structures, +with no longer relations involved like the use of grandchildren or great-grandchildren. -With the istgame package, you can draw a game tree -as if you were drawing a game tree with a pen and paper. +With the istgame package, you can draw a game tree +as easily as drawing a game tree with pen and paper. Dependencies: The package istgame depends on the packages tikz, xparse, and expl3. -License: +License: -This work may be distributed and/or modified -under the conditions of the LaTeX Project Public License, +This work may be distributed and/or modified +under the conditions of the LaTeX Project Public License, either version 1.3c of this license or any later version. -The latest version of this license is in +The latest version of this license is in http://www.latex-project.org/lppl.txt. Contacts: Please report any errors or suggestions to the author, -In-Sung Cho at . \ No newline at end of file +In-Sung Cho at . \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/istgame/istgame-doc-v1.0.tex b/Master/texmf-dist/doc/latex/istgame/istgame-doc-v1.0.tex deleted file mode 100644 index 8aaf825d665..00000000000 --- a/Master/texmf-dist/doc/latex/istgame/istgame-doc-v1.0.tex +++ /dev/null @@ -1,3327 +0,0 @@ -%!TEX root = istgame-doc.tex - -%\begin{document} -\setcounter{section}{-1} - -\section{Changes} - -A considerable number of macro names have been changed in the version 0.8 (Jan.\@ 17, 2017) of this package.\footnote{The \pkg{istgame} package of the version which is older than ver.\@ 1.0 had been distributed in the KTUG (Koran TeX Users Group).} -The following old macro names in any previously written documents using codes in \pkg{istgame} ver.\@ 0.7 or before, should be replaced by the new names, accordingly. - -Also, \cmd{\istroot*}, \cmd{\istcntm*}, and \cmd{\xtInfoset*} should be replaced by \cmd{\istrooto}, \cmd{\istcntmarc}, and \cmd{\xtInfoseto}, respectively, in the version 1.0 or later. - -\begin{center} -\begin{tabu}to\linewidth{X[l4]X[l3]X[l2]} \toprule -\makecell[l]{\textbf{ver.\@ 0.7 or before}} & \makecell[l]{\textbf{ver.\@ 0.8 or later}} & \makecell[l]{\textbf{ver.\@ 1.0 or later}}\\\midrule -\cmd{\xdistance} & \cmd{\xtdistance} & \\\tabucline- -\cmd{\xDot} &\cmd{\xtNode} & \\\tabucline- -\cmd{\xInfoset} &\cmd{\xtInfoset} & \\\tabucline- -\cmd{\xInfoset*} &\cmd{\xtInfoset*} & \\\tabucline- -\cmd{\xInfosetOwner} &\cmd{\xtInfosetOwner} & \\\tabucline- -\cmd{\xActionLabel} &\cmd{\xtActionLabel} & \\\tabucline- -\cmd{\xPayoff} &\cmd{\xtPayoff} & \\\tabucline- -\cmd{\ShowTerminalNodes} &\cmd{\xtShowTerminalNodes} & \\\tabucline- -\cmd{\HideTerminalNodes} &\cmd{\xtHideTerminalNodes} & \\\tabucline- -\cmd{\levdist} &\cmd{\xtlevdist} & \\\tabucline- -\cmd{\sibdist} &\cmd{\xtsibdist} & \\\tabucline- -\cmd{\setistactionlabelshift} & ~ & \cmd{\xtALPush} \\\tabucline- -\cmd{\setistactionlabelposition} & ~ & \cmd{\xtALShift} \\\tabucline- -\cmd{\istroot*} & & \cmd{\istrooto} \\\tabucline- -\cmd{\istcntm*} & & \cmd{\istcntmarc} \\\tabucline- -\cmd{\xtInfoset*} & & \cmd{\xtInfosetO} \\\bottomrule -\end{tabu} -\end{center} - -Here, the prefix `xt' stands for `extensive tree,' -so \cmd{\xtdiatnace} can be read as `extensive tree distance.' - - -\bigskip -\bigskip - -\remark A known problem with the \pkg{tikz-qtree} package: - -It seems that -\pkg{tikz-qtree} changes node anchors. -So, with the \pkg{tikz-qtree} uploaded, you will get unexpected results -when you draw a game tree by using the \xw{tree} library in \tikz. -Since \pkg{istgame} is based on the \xw{tree} library, it is also affected by \pkg{tikz-qtree}, resulting in unexpected outputs. - -The best way to resolve this problem is that you DO NOT LOAD \pkg{tikz-qtree} when you draw game trees with \tikz. -If, for some reason, you need to load \pkg{tikz-qtree} when you draw a game tree by using the \pkg{istgame} package, a temporary solution to resolve the conflict is to redefine the \pkg{istgame} environment as follows: - -\begin{tcblisting}{listing only} -\RenewDocumentEnvironment{istgame}{O{}} % accepts tikzpicture options - {\begin{tikzpicture}[% - edge from parent path={(\tikzparentnode\istparentanchor) -- - (\tikzchildnode\istchildanchor)}, % tikz-qtree conflict resolved - font=\istgamefontsize,>=stealth,#1 - ] - } - {\end{tikzpicture} - } -\end{tcblisting} - -\clearpage - -\section{Getting started} - -The package \ipkg{istgame} provides macros built on \tikz\ to draw game trees. The core macros provided with this package are \icmd{\istroot}, \icmd{\istb}, and \icmd{\endist}. -\cmd{\istroot} pins down the root of a tree or a subtree, \cmd{\istb} represents a branch, and \cmd{\endist} indicates the end of drawing a simple tree. Without \cmd{\endist}, the tree is not actually drawn, with no error messages produced. -A tree drawn by the sequence of \cmd{\istroot-}\cmd{\istb-}\cmd{\endist} is a \ixw{simple tree}. -You can draw a whole game tree by repeatedly connecting these `simple tree structures.' - -\mbigskip1 - -Here, the prefix `ist' stands for `it's a simple tree.' You can also read it as `insung's simple tree' if you would like. - -\mbigskip1 - -The package \pkg{istgame} depends on the packages \ipkg{tikz}, \ipkg{xparse}, and \ipkg{expl3}. - -To use the \pkg{istgame} package you must load the package in the preamble of your document: - -\quad \cmd{\usepackage\{istgame\}} - -The package loads the following \tikz\ libraries: - -\quad \verb+calc,arrows,shapes,positioning,patterns,trees,fit,backgrounds,quotes+ - - -\subsection{Getting-started example: a simple tree} - -Let us get started with a simple self-explanatory example: - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -%% \usepackage{istgame} -% Example: a simple tree -\begin{istgame} -\istroot(0)(0,0) % names the root as (0) at (0,0) - \istb % endpoint will be (0-1), automatically - \istb % endpoint will be (0-2), automatically - \istb % endpoint will be (0-3), automatically - \endist % end of simple (parent-child) structure -\end{istgame} -\end{tcblisting} - -The resulting tree has the height of 15mm and -the distance between two neighbor endpoints (not shown) is also 15mm by default. -In \tikz, the height is called the \ixw{level distance} and -the distance between two neighbor endpoints is called the \ixw{sibling distance}. - -If the second parenthesis argument of \cmd{\istroot} is omitted, it is regarded as (0,0) by default, -otherwise it is necessary to specify the coordinate from which a simple tree starts. - -\subsection{Connecting simple tree structures} - -Basically, in order to draw a whole game tree, we just repeat the simple \verb|\istroot-\istb-\endist| structure. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: connecting simple trees -\begin{istgame} -\istroot(0) % names the root (0) at (0,0) - \istb % endpoint will be (0-1), automatically - \istb % endpoint will be (0-2) - \istb % endpoint will be (0-3) - \endist % end of simple (parent-child) structure -\istroot(c)(0-3) % names the subroot (c) at (0-3) - \istb % endpoint will be (c-1) - \istb % endpoint will be (c-2) - \endist -\end{istgame} -\end{tcblisting} - -In the previous example, the simple `subtree' is rooted at \xw{(0-3)}, names the subroot \xw{(c)}, and has two branches whose endpoints are automatically named \xw{(c-1)} and \xw{(c-2)}, respectively. - -Note that the given names of the (sub)roots and the names of endpoints are given counterclockwise (from the left to the right) by \tikz\ at the endpoints of branches, which can be used as coordinates in the usual \tikz\ way. - -\subsection{Complete examples for desperate users} - -Basically, \cmd{\istroot} designates a decision node and its owner (or a player), -\cmd{\istb} prints a branch coming from the decision node with action labels and payoffs, and \cmd{\endist} actually draws the tree structures. - -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth,breakable} -% Example: first try -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot(0)(0,0){Child} - \istb{Good}[above left]{(0,2)} - \istb{Bad}[above right] - \endist -\istroot(1)(0-2)<30>{Parent} - \istb{Forgive}[above left]{(1,1)} - \istb{Punish}[above right]{(-1,-1)} - \endist -\end{istgame} -\end{tcblisting} - -\subsubsection{How to put a decision node and its owner} - -\begin{tcblisting}{listing only} -\istroot()(){} -\end{tcblisting} - -The only mandatory argument of \icmd{\istroot} is \xw{()} and all others are optional. -If the \xw{()} where a decision node is placed is omitted, it is regarded as \xw{(0,0)} by default. -The position of the owner is \xw{} (or equivalently, \xw{<90>}) degree by default. - -In fact, \cmd{\istroot} and its variations have much more functions than these. Later, you can look into section \ref{sec:istroot} for more details. - -\subsubsection{How to put action labels and payoffs} - -\begin{tcblisting}{listing only} -\istb{}[]{}[] -\end{tcblisting} - -With the macro \icmd{\istb}, you can put a action label and payoffs as optional arguments. -The positions of an action label and payoffs are specified as options right after each of the two. - -In fact, \cmd{\istb} and its variations have much more functions than these. See section \ref{sec:istb} for more details. If this is your first reading this manual, however, you don't need to bother about all the details at the moment. - -\subsubsection{How to put information sets} - -\begin{tcblisting}{listing only} -\xtInfoset()(){} -\end{tcblisting} - - -The macro \icmd{\xtInfoset} connects two nodes with a dotted line. -The two node coordinates are mandatory. -For more details about \cmd{\xtInfoset}, see section \ref{sec:infoset}. - -\mbigskip1 -In the following example, the macro \cmd{\xtInfoset} is used to show a information set. -\xw{[al]} is an abbreviation of \xw{[above left]}, and similarly for \xw{[ar]}, \xw{[bl]}, and \xw{[br]}. - -\begin{tcblisting}{listing outside text, righthand width=.35\linewidth} -% Example: information set -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot(0){Alice} - \istb{A}[al]{(2,2)} \istb{D}[ar] - \endist -\istroot(1)(0-2){Alice} - \istb{L}[al] \istb{R}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1) - \istb{\ell}[al]{(4,2)} \istb{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2) - \istb{\ell}[al]{(3,2)} \istb{r}[ar]{(0,3)} - \endist -\xtInfoset(2)(3){Elaine} -\end{istgame} -\end{tcblisting} - - - - -\section{Important distances: \protect\cmd{\xtdistance}} - -\label{sec:xtdistance} - -The length and the direction of branches in a simple tree can be controlled by the macro \icmd{\xtdistance}. -Here, the prefix `xt' stands for `extensive tree.' - -\begin{tcblisting}{listing only} -% syntax: \xtdistance - \xtdistance[]{}{} -% defaults: is the only mandatory argument - [1]{15mm}{15mm} -\end{tcblisting} - -\cmd{\xtdistance} sets or resets the level and sibling distances. -You can use \cmd{\xtdistance} at any time you want to change the length and the direction of branches. -Since we are dealing with simple `parent-child' tree structures, \xw{} is \xw{1} by default. -However, the level depth number other than 1 is not expected to be used. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \xtdistance -\begin{istgame} -\xtdistance{15mm}{15mm} % default -\istroot(0) % names the root (0) at (0,0) - \istb % endpoint will be (0-1), automatically - \istb % endpoint will be (0-2) - \istb % endpoint will be (0-3) - \endist % end of simple (parent-child) structure -\xtdistance{15mm}{30mm} % changes sibling dist -\istroot(a)(0-1) % names the subroot (a) at (0-1) - \istb % endpoint will be (a-1) - \istb % endpoint will be (a-2) - \endist -\istroot(a) -\end{istgame} -\end{tcblisting} - -For example, \cmd{\xtdistance\{20mm\}\{30mm\}} internally assigns \xw{20mm} to \icmd{\xtlevdist} and \xw{30mm} to \icmd{\xtsibdist}, which renews the default distances. - -\mbigskip1 -In fact, the core macros are much more powerful. \cmd{\istroot} controls the direction to which a simple parent-child tree grows, -node styles, the node owner and its position, the height and sibling distance of a current simple tree, etc. -\cmd{\istb} specifies the growing direction of an individual branch, branch line styles, branch color, the label of action, and the payoffs and their positions. -Below we will see in more detail how the core macros and others work. - - -\section{The \env{istgame} environment and node styles} - -\subsection{The \env{istgame} environment} - -\label{ssec:envistgame} - -This package provides the \ienv{istgame} environment, which is almost the sane as \ienv{tikzpicture} environment, -so this accepts all the options of the \env{tikzpicture} environment. - -\mbigskip1 -\begin{tcblisting}{listing only} -% definition: istgame environment -\def\istgamefontsize{\normalsize} -\NewDocumentCommand\setistgamefontsize {m} - {\renewcommand*{\istgamefontsize}{#1} - } -\NewDocumentEnvironment{istgame}{O{}} % accepts tikzpicture options - {\begin{tikzpicture}[font=\istgamefontsize,>=stealth,#1] - } - {\end{tikzpicture} - } -\end{tcblisting} - -The default font size is set as \verb|font=\normalsize|. -You can globally change the default font size by using \icmd{\setistgamefontsize}, like -\verb|\setistgamefontsize{\scriptsize}|. -Since the environment \env{istgame} is basically the same as \env{tikzpicture}, you can also locally change the font size by using the \xw{font} option key, like -\verb|\begin{istgame}[font=\scriptsize]...\end{istgame}|. - - -\subsection{Node styles} - -\label{sec:nodestyles} - -The \cmd{tikzstyle}'s of the six basic node styles are predefined. - -\begin{itemize}\tightlist -\item \ixw{plain node}: draws nothing (defaults: \xw{inner sep=1pt}, \xw{outer sep=0pt}) -\item \ixw{null node}: \begin{istgame}\istroot(0)[null node]\endist\end{istgame} (very small node, not expected to be used) -\item \ixw{solid node}: \begin{istgame}\istroot(0)[solid node]\endist\end{istgame} (default node style) -\item \ixw{hollow node}: \begin{istgame}\istroot(0)[hollow node]\endist\end{istgame} -\item \ixw{rectangle node}: \begin{istgame}\istroot(0)[rectangle node]\endist\end{istgame} -\item \ixw{ellipse node}: \begin{istgame}\istroot(0)[ellipse node]\endist\end{istgame} -\end{itemize} - - -For some special cases, you may want to change some node styles, including the minimum size. This can be done by \icmd{\setist<...>NodeStyle}, all of whose arguments are optional. - -\begin{verbatim} -syntax: - \setistPlainNodeStyle{}{} - \setistNullNodeStyle[]{}[][] - \setistSolidNodeStyle[]{}[][] - \setistHollowNodeStyle[]{}[][] - \setistRectangleNodeStyle[]{}[][] - \setistEllipseNodeStyle[]{}[][] -\end{verbatim} - - -\begin{tcblisting}{listing outside text, righthand width=.1\linewidth} -% Examples: -\begin{istgame}\setistSolidNodeStyle[blue]{10pt} - \istroot(0)[solid node]\endist\end{istgame}\\[1ex] -\begin{istgame}\setistHollowNodeStyle[blue]{10pt}[yellow] - \istroot(0)[hollow node]\endist\end{istgame}\\[1ex] -\begin{istgame}\setistRectangleNodeStyle{10pt}[red][.5] - \istroot(0)[rectangle node]\endist\end{istgame}\\[1ex] -\begin{istgame}\setistEllipseNodeStyle[blue]{10pt}[green] - \istroot(0)[ellipse node]\endist\end{istgame}\\[1ex] -\begin{istgame}\setistNullNodeStyle[blue!20]{10pt} - \istroot(0)[null node]\endist\end{istgame} -\end{tcblisting} - -\mbigskip1 - -These basic node styles have their aliases, for convenience, for those who are familiar with game theoretic terminology. - -\begin{tcblisting}{listing only,breakable} -% aliases for game theorists -\tikzstyle{decision node}=[solid node] % decision nodes -\tikzstyle{terminal node}=[solid node] % terminal nodes -\tikzstyle{initial node}=[hollow node] -\tikzstyle{chance node}=[hollow node] -\end{tcblisting} - -The set of all nodes of a game tree can be partitioned into -the set of \xw{decision nodes}\index{decision node} and that of \xw{terminal nodes}\index{terminal node}. -You can use \ixw{initial node} -to distinguish the \ixw{root} (or the \xw{initial node}) of a game tree from decision nodes. -You can also use \ixw{chance node} to represent a chance node of a game tree. - -%You can also change the node styles, like \verb|\setistDecisionNodeStyle[blue]{3pt}|. - -Additional convenient node aliases are also provided: \ixw{box node}, \ixw{square node}, and \ixw{oval node}. - -\begin{tcblisting}{listing only,breakable} -% some more aliases -\tikzstyle{box node}=[rectangle node] -\tikzstyle{square node}=[rectangle node] -\tikzstyle{oval node}=[ellipse node] -\end{tcblisting} - -For aliases, you can also change the node styles, like \verb|\setistDecisionNodeStyle[blue]{3pt}| or \verb|\setistBoxNodeStyle{3pt}[green][.5]|. - -\section{Core macro: \protect\cmd{\istroot}} - -\label{sec:istroot} - -\subsection{\protect\cmd{\istroot}: basics} - -\subsubsection{\protect\cmd{\istroot} -- counterclockwise (standard version)} - -\label{ssec:istroot} - -The macro \cmd{\istroot} defines the root of a game or a subgame at a designated location, specifies the owner of the (sub)root, and does other functions. -In game theoretic terminology, \cmd{\istroot} designates a decision node and its owner (or a player). - -\begin{tcblisting}{listing only,breakable} -% \istroot -% syntax: - \istroot[,]()()[,]% - {}+..+ -% defaults: - [south]()(0,0)[decision node]{}+15mm..15mm+ -% arguments: (coor1) is mandatory, all others are optional arguments - [grow] % the direction of growing - (coor1) % name of the (sub)root: mandatory - (coor2) % the (sub)root is at (coor2) - [node style] % node style - % position of owner name - {owner} % name of the owner of the (sub)root - +level dist..sibling dist+ % -\end{tcblisting} - -The only mandatory argument of \cmd{\istroot} is \xw{()}, which gives the name of the root or subroot. All the other arguments are optional. The name of the (sub)root, \xw{()}, can be referred as a normal coordinate. -\xw{(coor2)} specifies the location where the (sub)root is placed. -If \xw{(coor2)} is omitted, it is regarded as \xw{(0,0)} by default. - -The default node style of the root is a \xw{decision node}, which is just a solid node. You can change the node style to, for example, an \xw{oval node} or a \xw{box node}. - -The owner of a decision node (or a player) is expressed with curly braces. -The position of the owner of a decision node is specified with angle brackets, like \xw{<90>}, \xw{}, or \xw{}. -To specify the position of the owner you can use \xw{}, or the compass directions such as \xw{}, \xw{}, \xw{}, \xw{}, and their valid combinations. -You can also use the positional words such as \xw{}, \xw{}, \xw{}, \xw{}, and their valid combinations. - -%\mbigskip1 - -Here is a simple example of drawing a tree structure. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \istroot -\begin{istgame} -\istroot(0) - \istb \istb \istb \endist -\istroot(a)(0-1) - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -In the previous example, the game tree has the root named \xw{(0)}, located at \xw{(0,0)} by default, which has three branches. -Since \tikz\ arranges branches of a tree counterclockwise, by default, -the endpoints of the three branches are automatically named \xw{(0-1)}, \xw{(0-2)}, and \xw{(0-3)} from left to right or counterclockwise. - -The root of the subtree is named \xw{(a)}, located at \xw{(0-1)}, and has two children. -Its children are automatically named \xw{(a-1)} and \xw{(a-2)} \ixw{counterclockwise} (or from left to right if the tree grows down). -See the following code example with explanatory labels to see what is going on. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \istroot (explained with labels) -\begin{istgame}[font=\scriptsize] -\istroot(0) - \istb \istb \istb \endist -\istroot(a)(0-1) - \istb \istb \endist -%% labels: (ignore the following lines at the moment) -\xtOwner(0){(0)} -\xtOwner(0-1){(0-1)}[r] -\xtOwner(0-2){(0-2)}[b] -\xtOwner(0-3){(0-3)}[b] -\xtOwner(a){(a)}[l] -\xtOwner(a-1){(a-1)}[b] -\xtOwner(a-2){(a-2)}[b] -\draw [->,ultra thick,blue!20](-260:1.5) - arc (-260:80:1.5cm) - node [above,blue!30] {counterclockwise}; -\end{istgame} -\end{tcblisting} -\label{page:clockwise} - - -\mbigskip1 - -Internally, \xw{[]} typed in as the first option of \cmd{\istroot} renews the direction of tree growing by assigning its value to \icmd{\istgrowdirection}, whose default is \xw{south}. - -\mbigskip1 - -\remark For some cases, you may want to use options other than the grow direction, in the bracket before \xw{(coor1)}. In this case, the first thing in the bracket must be \xw{}, like \xw{[south,blue,dashed]} (see section \ref{sec:firstthing} on page \pageref{sec:firstthing}). - -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 1: \istroot (one simple tree) -\begin{istgame}[font=\itshape] -\istroot[right](0){player 1} - \istb \istb \endist -\end{istgame} -\end{tcblisting} -\label{page:onesimpletree} - - -\mbigskip1 -The tree growing direction can be specified by \xw{[]} or by using the compass directions such as -\xw{[north]}, \xw{[south]}, \xw{[east]}, \xw{[west]}, \xw{[north east]}, \xw{[north west]}, \xw{[south east]}, \xw{[south west]}. -You can also use positional words like \xw{[left]}, \xw{[rigth]}, \xw{[down]}, and \xw{[up]}, but you cannot \xw{[above]} nor \xw{[below]}. - -\remark One thing you should remember about this is that \cmd{\istgrowdirection} is internally used -in the definition of \cmd{\istb} to control the label position for payoffs. -However, for the label position, \xw{[below]} and \xw{[above]} are good, -but not \xw{[down]} nor \xw{[up]}. -So DO NOT USE \xw{[down]} and \xw{[up]} to specify the tree growing direction. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 2: \istroot (three simple trees connected) -\begin{istgame} -\xtdistance{20mm}{20mm} -\istroot[right](0)[oval node]{player 1} - \istb \istb \endist -\istroot(a)(0-1){player 2}+15mm..10mm+ - \istb \istb \endist -\istroot[right](b)(0-2)[box node]<135>{player 3} - \istb \istb \endist -\end{istgame} -\end{tcblisting} -\label{page:threesimpletrees} - -The last two options of \cmd{\istroot} specify the \xw{level distance} and the \xw{sibling distance}. -This change of distances is valid only for the corresponding simple tree, while distance change by \cmd{\xtdistance} is valid within the current \pkg{istgame} environment unless it is changed again by \cmd{\xtdistance}. -Do not forget, when you use decimal distances, to delimit the decimal dimensions with curly braces, like -\verb|+{15.5mm}..{10.5mm}+|. - -\subsubsection{\protect\cmd{\istroot'} -- clockwise (swap version)} - -\label{ssec:istroot'} - -The macro \icmd{\istroot'} is the swap version of \cmd{\istroot}. -\cmd{\istroot'} works just like \cmd{\istroot}, but with one exception: going clockwise instead of counterclockwise. -\cmd{\istroot'} arranges its branches \ixw{clockwise} (or from right to left if the tree grows down). - -Compare the following example with that of \cmd{\istroot} on page \pageref{page:clockwise}. -The two examples have exactly the same codes as each other except for one thing: either \cmd{\istroot} or \cmd{\istroot'}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \istroot' (explained with labels) -\begin{istgame}[font=\scriptsize] -\istroot'(0) - \istb \istb \istb \endist -\istroot'(a)(0-1) - \istb \istb \endist -%% labels: (ignore the following lines at the moment) -\xtOwner(0){(0)} -\xtOwner(0-1){(0-1)}[r] -\xtOwner(0-2){(0-2)}[b] -\xtOwner(0-3){(0-3)}[b] -\xtOwner(a){(a)}[l] -\xtOwner(a-1){(a-1)}[b] -\xtOwner(a-2){(a-2)}[b] -\draw [<-,ultra thick,blue!20](-260:1.5) - arc (-260:80:1.5cm) - node [above,blue!30] {clockwise}; -\end{istgame} -\end{tcblisting} - - -We will look into this issue (of going counterclockwise or clockwise) in more detail in section \ref{sec:growing}, where we examine the tree growing direction. - -If you draw a game tree growing south, you don't need to worry about the swap version \cmd{\istroot'} and just use \cmd{\istroot}. - -\subsection{\protect\cmd{\istrooto}: oval version} - -\label{ssec:istrootstar} - -\subsubsection{\protect\cmd{\istrooto} -- counterclockwise} - -The macro \icmd{\istrooto} is the oval version of \cmd{\istroot}. -This allows us to draw a bubble (by default, \xw{oval node}) with a node owner (or a game player) in it. With one exception to this, \cmd{\istrooto} works just like \cmd{\istroot}. Since the owner is shown in the specified node in \cmd{\istrooto}, the option \xw{} of the standard version \cmd{\istroot} is ignored. - -\begin{tcblisting}{listing only,breakable} -% \istrooto -% syntax: - \istrooto[]()()[]{}+levd..sibd+ -% default: only (coor1) is mandatory, all others optional - [south]()(0,0)[oval node]{}+15mm..15mm+ -\end{tcblisting} - -\mbigskip1 - -The following example is the same as above with \cmd{\istroot} on page \pageref{page:onesimpletree}, but now with the oval version. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 1: \istrooto (one simple tree) -\begin{istgame}[font=\itshape] -\istrooto[right](0)<180>{player 1} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -The following example is also the same as above with \cmd{\istroot} on page \pageref{page:threesimpletrees}, but now with the oval version. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 2: \istrooto (three simple trees connected) -\begin{istgame} -\xtdistance{20mm}{20mm} -\istrooto[right](0)[oval node]{player 1} - \istb \istb \endist -\istroot(a)(0-1){player 2}+15mm..10mm+ - \istb \istb \endist -\istrooto[right](b)(0-2)[box node]<135>{player 3} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -Notice that the angle \xw{<180>}, \xw{}, \xw{}, or \xw{<135>} specifying the position of the owner's name is redundant to \cmd{\istrooto}. - -\mbigskip1 - -\remark Note that, in \tikz, a tree branch comes from the center of the parent node and goes to the center of the child node. -%Now what if you want to have branches coming from some point of the circumference of, say, an oval parent node to that of a child node. -%\cmd{\setistbranchanchors} specifies the anchors of parent node and child node. (experimental!) -% -%\begin{tcblisting}{listing only} -%% \setistbranchanchors (experimental!) -%% syntax: \setistbranchanchors -% \setistbranchanchors{}{} -%% defaults: is mandatory -% {}{center} -%\end{tcblisting} - -Note also that \cmd{\istrooto} arranges its branches \ixw{counterclockwise}. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -% Example 3: \istrooto (counterclockwise) -\begin{istgame} -\setistOvalNodeStyle{.6cm} -\istrooto(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtShowEndPoints[oval node] -\xtdistance{12.5mm}{11.5mm} -\istrooto(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] - \istb{}{8}[center] \endist -\istrooto(6)(2-1){6} - \istb{}{9}[center] \istb{}{10}[center] - \endist -\draw [->,ultra thick,blue!20](-260:1.5) - arc (-260:80:1.5cm) - node [above,blue!30] {counterclockwise}; -\end{istgame} -\end{tcblisting} - - -\subsubsection{\protect\cmd{\istrooto'} -- clockwise (swap version)} - -The swap version of the oval version \icmd{\istrooto'} works just like \cmd{\istroot'} with one exception that it puts the owner within an oval node, by default. -\mbigskip1 - - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 2: \istrooto (three simple trees connected) -\begin{istgame} -\xtdistance{20mm}{20mm} -\istrooto'[right](0)[oval node]{player 1} - \istb \istb \endist -\istrooto'[right](b)(0-1)[box node]<135>{player 2} - \istb \istb \endist -\istroot(a)(0-2){player 3}+15mm..10mm+ - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 -The swap version is useful when a tree grows north or east. -The following example shows the tree rotating to the north by using \icmd{\setistgrowdirection}. -Note that \cmd{\istrooto'} arranges its branches \ixw{clockwise}. - - -\mbigskip1 -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -% Example 3: \istrooto' (clockwise) -\begin{istgame} -\setistgrowdirection{north} -\setistOvalNodeStyle{.6cm} -\istrooto'(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtShowEndPoints[oval node] -\xtdistance{12.5mm}{11.5mm} -\istrooto'(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto'(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] - \istb{}{8}[center] \endist -\istrooto'(6)(2-1){6} - \istb{}{9}[center] \istb{}{10}[center] - \endist -\draw [->,ultra thick,blue!20](260:1.5) - arc (260:-80:1.5cm) - node [below,blue!30] {clockwise}; -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -%\noindent -%* Known Problem: Two examples above show that \cmd{\setistbranchanchors} does not work as expected for the first child node anchor. - - - -%\clearpage - -\section{Core macro: \protect\cmd{\istb}} - -\label{sec:istb} - -\subsection{\protect\cmd{\istb}: basics} - -\label{ssec:istb} - -The macro \icmd{\istb}, basically, prints a branch. -Having all arguments as options, a simple \cmd{\istb} draws a branch from a parent node designated by \cmd{\istroot} to a child node (or endpoint of \cmd{\istb}). -If, for example, a parent node is name \xw{(A)} by \cmd{\istroot}, the first child node is automatically named \xw{(A-1)}, the second child node \xw{(A-2)}, and so on. - -\mbigskip1 -The macro \cmd{\istb} also puts an action label and payoffs along with a branch, and does other functions. -Note that the action labels and payoffs are defined to be typeset in the math mode, -so you can use \verb|\text{...}| when you want to typeset them in the text mode. - -\mbigskip1 -\begin{tcblisting}{listing only,breakable} -% \istb -% syntax: - \istb[]{}[]{}[] -% defaults: - {-}{}[center]{}[\istgrowdirection] -% arguments: all arguments are optional - % the direction of a branch - [line style] % branch line style - {action} % action label (in math mode) - [action pos] % position of action label - {payoff} % payoffs (in math mode) - [payoff pos] % position of payoffs -\end{tcblisting} - -In the following example, each \cmd{\istb} draws a branch. -With the option \xw{}\index{missing}, \cmd{\istb} prints an invisible branch. -Since the third child is missing the last child was named \xw{(0-4)}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \istb -\begin{istgame} -\istroot(0) - \istb \istb \istb \istb \endist -\istroot(D)(0-4) - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -The macro \cmd{\istb} also has various options to control the line style of a branch, and the direction and length of a branch. -\cmd{\istb} can also place payoffs to the direction of tree growth by default. - -\mbigskip1 - -\remark What is \icmd{\istgrowdirection} and what is it used for?\par - -\cmd{\istgrowdirection} has the value of \xw{[]} typed in \cmd{\istroot} (default: \xw{south}).\par -The value of \cmd{\istgrowdirection} specifies the direction of putting `payoffs' with \xw{south} by default. -We will see this in more detail below. - -\mbigskip1 - -For various line styles of a branch, you can use any options in \tikz\ of arrows, linewidth, color, and so on. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \istb (branch line styles) -\begin{istgame} -\istroot(0) - \istb[dashed,thick]{A}{(0,1)} - \istb[->]{}{(1,-1)} - \istb[blue,very thick]{B}[above]{(1,2)} - \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -By default, an action label is put on the mid point of the corresponding branch. -\mbigskip1 - -To specify the position of an action label, -you can use the positional words or their abbreviations below:\par -\xw{[a]} for \xw{[above]}, \xw{[b]} for \xw{[below]}, \xw{[l]} for \xw{[left]}, \xw{[r]} for \xw{[right]},\par -\xw{[al]} for \xw{[above left]}, \xw{[ar]} for \xw{[above right]}, \par -\xw{[bl]} for \xw{[below left]}, and \xw{[br]} for \xw{[below right]}. - -\remark Note that these abbreviations must be used with no other options, otherwise you will get a compile error. - -\mbigskip1 - -In the following example, notice that the tree grows south east and the payoffs are placed south east. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: tree toward south east (or -45 degree) -\begin{istgame} -\istroot[-45](0) - \istb[dashed,thick]{A}{(0,1)} - \istb[->]{}{(1,-1)} - \istb[blue,very thick]{B}[above]{(1,2)} - \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -If you do not like the position of the payoffs, you can change it by using degrees, the compass directions, or the positional words and their abbreviations mentioned above. -In the following example, the tree grows south west, but the position of the payoffs at the end of the blue branch is changed to \xw{[below]} - -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: tree toward south west (or 225 degree) -\begin{istgame} -\istroot[south west](0) - \istb[dashed,thick]{A}{(0,1)} - \istb[->]{}{(1,-1)} - \istb[blue,very thick]{B}[right]{(1,2)}[below] - \endist -\end{istgame} -\end{tcblisting} - -\subsection{\protect\cmd{\istb*} (starred version)} - -\label{ssec:istbstar} - -The starred version \icmd{\istb*} prints a solid node (by default) at the end of the corresponding branch. -This is the only difference between \cmd{\istb} and \cmd{\istb*}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \istb* -\begin{istgame} -\istroot[east](0) - \istb[dashed,thick]{A} - \istb*[->]{}{(1,-1)} - \istb[blue,very thick]{B}[above] - \endist -\end{istgame} -\end{tcblisting} - -\subsubsection*{\protect\cmd{\xtShowEndPoints} and \protect\cmd{\xtHideEndPoints}} - -\label{page:endpoint} - -Each endpoint is printed by each execution of \cmd{\istb*}. -You can print solid nodes (by default) at `all' the endpoints of `simple trees' by \icmd{\xtShowEndPoints}. -You can also change the shape of nodes of endpoints of simple trees by specifying it as an optional argument, like -\cmd{\xtShowEndPoints[oval node]}. -\icmd{\xtHideEndPoints} turns off the effect of \cmd{\xtShowEndPoints}. - -\mbigskip1 - -\begin{tcblisting}{listing only,breakable} -% \xtShowEndPoints -% syntax: - \xtShowEndPoints[] -% default: - [solid node] -\end{tcblisting} - -\mbigskip1 - -Here is an example of using \cmd{\xtShowEndPoints} and \cmd{\xtHideEndPoints}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \xtShowEndPoints, \xtHideEndPoints -\begin{istgame} -\xtShowEndPoints[oval node] -\istroot(0)[solid node] - \istb[dashed,thick]{A} - \istb - \istb[very thick]{B}[ar] - \endist -\xtdistance{15mm}{10mm} -\istroot(b)(0-2) \istb \istb \endist -\xtHideEndPoints -\istroot(b)(0-3) \istb \istb \endist -\end{istgame} -\end{tcblisting} - - -Note that \cmd{\xtShowEndPoints} and \cmd{\xtHideEndPoints} should be in an \env{istgame} environment to avoid unexpected results. -Note also that \cmd{\istb*} overrides all the effects of these two macros by printing a \pkg{solid node}. - - -\subsection{\protect\cmd{\istb.}~(period version)} - -\label{ssec:istbperiod} - -The period version \icmd{\istb.}\ is designed to represent a `terminal move' in a game tree. -Basically, \cmd{\istb.}\ works exactly the same way as \cmd{\istb} does. -However, using \cmd{\istb.}\ together with \cmd{\xtShowTerminalNodes} can control the shape of all the terminal nodes at once. - -\subsubsection*{\protect\cmd{\xtShowTerminalNodes} and \protect\cmd{\xtHideTerminalNodes}} - -\label{page:terminalnode} - -The period version \cmd{\istb.}\ used with \icmd{\xtShowTerminalNodes} prints a solid node (by default). -You can change the style of the terminal nodes, like \cmd{\xtShowTerminalNodes[oval node]}. -This effect can be turned off by \icmd{\xtHideTerminalNodes}. - -\begin{tcblisting}{listing only,breakable} -% \xtShowTerminalNodes (works only with \istb.) -% syntax: - \xtShowTerminalNodes[] -% default: - [solid node] -\end{tcblisting} - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: \xtShowTerminalNodes, \xtHideTerminalNodes -\begin{istgame} -\xtShowTerminalNodes[oval node] -\istroot(0)[solid node] - \istb.[dashed,thick]{A} - \istb - \istb[very thick]{B}[ar] - \endist -\xtdistance{15mm}{10mm} -\istroot(b)(0-2) \istb. \istb. \endist -\xtHideTerminalNodes -\istroot(b)(0-3) \istb. \istb. \endist -\end{istgame} -\end{tcblisting} - - - -\section{Players, action labels, and payoffs} - -\subsection{How to put players} - -\subsubsection{Players: basics} - -As discussed in \ref{ssec:istroot}, the macro \cmd{\istroot} specifies the (sub)root and puts its owner (or a player). -The direction to which a player label is put is set by the angle \xw{< >} option of \cmd{\istroot}, like \xw{} (by default), \xw{<0>}, or \xw{<45>}. -To specify the direction you can use degrees, the compass directions, or the positional words. - -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: node owner -\begin{istgame} -\istroot(0){Child} % default: - \istb \istb \endist -\istroot(1)(0-2)<45>{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -\remark -The auxiliary macro \cmd{\xtOwner} is provided for an extra way of putting owners of decision nodes (see section \ref{sec:auxmac}). - -\mbigskip1 -Note that \cmd{\istrooto} produces a bubble type node with the owner in it, so the directional option \xw{} is redundant with \cmd{\istrooto} (see section \ref{ssec:istrootstar}). - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: node owner (with \istrooto) -\begin{istgame} -\istrooto(0){Child} - \istb \istb \endist -\istrooto(1)(0-2)<45>{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -\subsubsection{Coloring players or a whole simple tree: \protect\cmd{\istroot}} - -\label{sec:firstthing} - -You can change the color of a player's name by giving \xw{color} with the angle option of \cmd{\istroot}, like \xw{<[red]>} or \xw{<[blue]45>}. -(This is the \tikz\ way for giving options for \xw{label}.) - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: coloring players -\begin{istgame} -\istroot(0)<[red]>{Child} - \istb \istb \endist -\istroot(1)(0-2)<[blue]45>{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 -The following example shows how you color a whole simple tree: \xw{red} for the Child's simple tree and \xw{blue} for the Parent's simple tree. - -\mbigskip1 -\remark Note that the first thing in the \xw{[option]} of \cmd{\istroot} must be `the direction of tree growing,' so it should be set as \xw{[south,red]} or \xw{[-90,blue]}. -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: coloring a simple tree -\begin{istgame} -\istroot[south,red](0)% all branches will be red - [fill=red,draw=red]<[red]>{Child} % node/owner - \istb \istb \endist -\istroot[-90,blue](1)(0-2)% all, blue branches - [blue]<[blue]45>{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -\subsubsection{Decorating players or a whole simple tree: \protect\cmd{\istrooto}} - -With \cmd{\istrooto} the color of a player can be changed by \xw{[option]}, such as \xw{[red]} or \xw{[blue]}. -(This is the \tikz\ way for giving options for \xw{node}.) - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: coloring players (with \istrooto) -\begin{istgame} -\istrooto(0)[red]{Child} - \istb \istb \endist -\istrooto(1)(0-2)[blue]{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - -The next example shows how you can color a whole simple tree \xw{red} or \xw{blue}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: coloring a simple tree (with \istrooto) -\begin{istgame} -\istrooto[south,red](0)[draw=green,blue]{Child} - \istb \istb \endist -\istrooto[-90,blue](1)(0-2)[draw=blue,blue]{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - - -What if you want to paint some color into the background of each oval node or box node? You can also do this simply by using the \tikz\ way for giving options for nodes. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: decorating oval/box nodes -\begin{istgame} -\istrooto(0)[top color=white, - bottom color=blue!80!black,yellow]{Child} - \istb \istb \endist -\istrooto(1)(0-2)[box node,fill=red!20,blue]{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - - -\subsection{How to put action labels} - - -\subsubsection{Action labels: basics} - -The macro \cmd{\istb} prints a branch and its action label. -Note that action labels are printed in the math mode. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: actions labels -\begin{istgame} -\istroot(0) - \istb{Good}[left] \istb{Bad} \endist -\istroot(1)(0-2) - \istb{\text{\fbox{$\alpha$}}}[above left] - \istb{\text{\fbox{$\beta$}}}[above right] - \endist -\end{istgame} -\end{tcblisting} - -By default, \cmd{\istb} prints its action label on the mid point of the corresponding branch. -You can specify the position of an action label with the positional words and their abbreviations, but not by the compass directions or degrees. - -Notice that with the abbreviations the position of the action labels are (internally) adjusted to get better result (for more details, see section \ref{sec:abb}). -In the following example, the abbreviations are used. -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: actions labels with abbreviations -\begin{istgame} -\istroot(0) - \istb{Good}[l] \istb{Bad} \endist -\istroot(1)(0-2) - \istb{\text{\fbox{$\alpha$}}}[al] - \istb{\text{\fbox{$\beta$}}}[ar] - \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -\remark -The auxiliary macro \cmd{\xtActionLabel} is provided for an extra way of putting an action label (see section \ref{sec:auxmac}). - -\subsubsection{Changing the color of action labels and the style of branches} - -You can change the color of action labels with \tikz\ options. -In the following example, the bracket options before an action label are for a branch and those after are only for the action label. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: color and line style -\begin{istgame} -\istroot(0) - \istb[dashed,thick]{A}[al] - \istb[blue,very thick]{B}[r] - \istb[blue,very thick]{C}[above right,red] - \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 -\remark It is important to remember that you cannot use the abbreviations with additional options. For example, you can do like \cmd{\itsb\{C\}[ar]}, but not \cmd{\istb\{B\}[ar,red]}. Instead, you should do \cmd{\istb\{C\}[above right,red]}. - -\subsection{How to put payoffs} - -\subsubsection{Payoffs: basics} - -The macro \cmd{\istb} can also print a branch and the corresponding payoffs near at its endpoint. -Note also that payoffs are printed in the math mode. The payoffs are put in the direction set by \cmd{\setistgrowdirection} (\xw{south}, by default), unless it is changed by \xw{} of \cmd{\istroot}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: payoffs -\begin{istgame} -\istroot(0) - \istb{Good}[l]{0,2} - \istb{Bad} - \endist -\istroot(1)(0-2) - \istb{\alpha}[al]{(1,1)} - \istb{\beta}[ar]{-1,-1} - \endist -\end{istgame} -\end{tcblisting} - -\subsubsection{Payoffs and \protect\cmd{\istgrowdirection}} - -The direction of where payoffs are put from a terminal node follows \cmd{\istgrowdirection} typed in as the first optional argument of \cmd{\istroot}. -The default direction is \xw{south} and can be changed by \cmd{\setistgrowdirection}. -For example, \cmd{\setistgrwodirection\{north\}} changes the default direction to \xw{north}. - -To specify the tree growing direction or the position of the payoffs to put, you can use degrees, the compass words, or the positional words and their abbreviations. - -\mbigskip1 -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: grow=south (default) -\begin{istgame} -\xtShowEndPoints[box node] -\istroot(0) - \istb[dashed,thick]{A}{\binom23} - \istb*{}{(-2,3)} - \istb.[blue,very thick]{B}[ar]{2,3} - \endist -\end{istgame} -\end{tcblisting} - -By default, \xw{grow=south}, so \cmd{\istgrowdirection} is \xw{south} (or \xw{below} or \xw{-90}).\par -This example shows payoffs at the south of terminal nodes. - -%\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: grow=right (or east or 0 degree) -\begin{istgame} -\xtShowTerminalNodes[oval node] -\istroot[right](0) - \istb[dashed,thick]{A}{\binom23} - \istb*{}{(-2,3)} - \istb.[blue,very thick]{B}[al]{2,3} - \endist -\xtHideTerminalNodes -\end{istgame} -\end{tcblisting} - -\verb|grow=right=\istgrowdirection|, so the payoffs are put on the right. -% - -\mbigskip1 -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: grow=north -\begin{istgame} -\setistgrowdirection{north} -\istroot(0) - \istb[dashed,thick]{A}{\binom23} - \istb*{}{(-2,3)} - \istb.[blue,very thick]{B}[bl]{2,3} - \endist -\end{istgame} -\end{tcblisting} - -\verb|grow=north=\istgrowdirection|, so the payoffs are put above the terminal nodes. - -\mbigskip1 -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -\begin{istgame} -\istroot[south west](0) - \istb[dashed,thick]{A}{\binom23} - \istb{}{(-2,3)} - \istb[blue,very thick]{B}[right]{2,3}[b] - \endist -\end{istgame} -\end{tcblisting} - -\verb|grow=south west=\istgrowdirection|, so the payoffs are put below left of the terminal node. - -\mbigskip1 -You can adjust the direction of putting any payoff by specifying an option right after the payoff, like \verb|\istb[blue,very thick]{B}[right]{2,3}[below]|. - -You can use the abbreviations \xw{[l]}, \xw{[r]}, \xw{[a]}, and \xw{[b]} for \xw{[left]}, \xw{[right]}, \xw{[above]}, and \xw{[below]}, respectively. -The abbreviations \xw{[al]}, \xw{[ar]}, \xw{[bl]}, and \xw{[br]} can also be used -for \xw{[above left]}, \xw{[above right]}, \xw{[below left]}, and \xw{[below right]}, respectively, -to put payoffs (for more details about abbreviations, see section \ref{sec:abb}). - -Notice also that, instead of the positional words, you can use the compass directions or degrees, like \verb|\istb[blue,very thick]{B}[right]{2,3}[-90]|. - - -\subsubsection{Coloring payoffs} - -You can change the color of the payoffs by giving options with the positional words. -For example you can do like \xw{\istb...\{(1,1)\}[[blue]below]}. -This is the \tikz\ way of giving options for \xw{label}. -Notice that, in this case, you should not use the abbreviation of the positional words. - -\begin{tcblisting}{listing outside text, righthand width=.2\linewidth} -% Example: payoffs -\begin{istgame} -\istroot(0) - \istb{Good}[l]{0,2} \istb{Bad} \endist -\istroot(1)(0-2) - \istb{\alpha}[al]{(1,1)}[[red]below] - \istb{\beta}[ar]{-1,-1}[[blue]below] - \endist -\end{istgame} -\end{tcblisting} - -%\clearpage -\section{Fine-tuning positions of players, action labels, and payoffs (experimental)} - -\subsection{Fine-tuning positions: owners} - -If you are not satisfied the position of the owner (or a player), you can change it by using the \tikz\ options such as \xw{xshift}, \xw{yshift}, or \xw{label distance} with the angle option of \cmd{\istroot}. - -Examples are \xw{<[xshift=10pt]above>\{Child\}} and \xw{<[label distance=-5pt]45>\{Parent\}}, as shown in the following. - -\begin{tcblisting}{listing outside text, righthand width=.2\linewidth} -% Example: node owner -\begin{istgame} -\istroot(0)<[xshift=10pt]above>{Child} - \istb \istb \endist -\istroot(1)(0-2)<[label distance=-5pt]45>{Parent} - \istb \istb \endist -\end{istgame} -\end{tcblisting} - - -%\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -%\begin{istgame}[scale=1.2] -%\istcntm(ctm)[green]+8mm..24mm+ -%\istroot(0)(ctm){I}+8mm..8mm+ -% \istb{x}[r] -% \istb -% \endist -%\xtdistance{10mm}{18mm} -%\istroot(1)(0-1)<[label distance=-3pt]120>{II} -% \istb{Y}[l]{x,1-x} -% \istb{N}[r]{0,0} -% \endist -%\end{istgame} -%\end{tcblisting} - - -\subsection{Fine-tuning positions: action labels} - - -\subsubsection{Abbreviations: \xw{[l]}, \xw{[r]}, \xw{[a]}, and \xw{[b]}} - -As discussed in \ref{ssec:istb}, the macro \cmd{\istb} deals with the action labels. - -In order to determine the direction of action labels for branches to put, you can use degrees, the compass directions, or the positional words and their abbreviations as mentioned above. -(Internally, the abbreviations for payoffs and those for action labels work slightly differently in terms of \xw{xshift} and \xw{yshift}.) - - -\begin{tcblisting}{listing outside text, righthand width=.2\linewidth} -% Example: action labels (default position) -\begin{istgame}[scale=1.2] -\xtShowEndPoints -\xtdistance{12mm}{16mm} -\istroot(0)[initial node] - \istb{\fbox{$a$}}[a] \istb{\fbox{$l$}}[l] - \istb{\fbox{$b$}}[b] \istb{\fbox{$r$}}[r] - \endist -\end{istgame} -\end{tcblisting} -%\captionof{figure}{action labels by defaults with \xw{l}, \xw{r}, \xw{a}, and \xw{b}} - -When you use these abbreviations you can manipulate the horizontal and/or the vertical shifts toward branches by using \icmd{\xtALPush}. (This is experimental!) - -%\mbigskip1 - -\begin{tcblisting}{listing only} -% syntax: - \xtALPush{ for l and r}{ for a and b} -% default: - {0pt}{0pt} -\end{tcblisting} - -\mbigskip1 -For example, \verb|\xtALPush{-3pt}{5pt}| draws the labels left and right by \xw{3pt} to the branch and push those put above and below \xw{5pt} away from the branch, as shown in the following. - -\begin{tcblisting}{listing outside text, righthand width=.2\linewidth} -% Example: \xtALPush -\begin{istgame}[scale=1.2] -\xtShowEndPoints -\xtALPush{-3pt}{5pt} % look here -\xtdistance{12mm}{16mm} -\istroot(0)[initial node] - \istb{\fbox{$a$}}[a] \istb{\fbox{$l$}}[l] - \istb{\fbox{$b$}}[b] \istb{\fbox{$r$}}[r] - \endist -\end{istgame} -\end{tcblisting} -%\captionof{figure}{action labels shifted: comparison} - - - - - - -\subsubsection{Abbreviations: \xw{[al]}, \xw{[ar]}, \xw{[bl]}, and \xw{[br]}} -\label{sec:abb} - -You can also use the abbreviations \xw{al}, \xw{ar}, \xw{bl}, and \xw{br} to represent -\xw{above left}, \xw{above right}, \xw{below left}, and \xw{below right}, respectively, -to position action labels. Precise representation of abbreviations is as follows: -\begin{itemize}%\tightlist -\item \xw{[al]} represents \verb|[above left,xshift=1pt,yshift=-2pt,black]| -\item \xw{[ar]} represents \verb|[above right,xshift=-1pt,yshift=-2pt,black]| -\item \xw{[bl]} represents \verb|[below left,xshift=1pt,yshift=2pt,black]| -\item \xw{[br]} represents \verb|[below right,xshift=-1pt,yshift=2pt,black]| -\end{itemize} - -\mbigskip1 - -%\begin{tcblisting}{listing outside text, righthand width=.35\linewidth} -\begin{tcblisting}{listing above text} -% Example: action labels with abbreviations -\begin{istgame}[scale=1.1] -\xtShowTerminalNodes[oval node,line width=.3pt] -\def\xbox#1{\fbox{$#1$}} \def\ybox#1{#1} -\xtdistance{12mm}{16mm} -\istroot(0)[initial node] - \istb{\ybox{a}}[a] - \istb{\ybox{l}}[l] - \istb{\ybox{b}}[b] - \istb{\ybox{r}}[r] - \endist -\begin{scope}[line width=1.2] -\xtdistance{10mm}{20mm} -\istroot[90](N)(0-2) - \istb.[red]{\xbox{br}}[br]{1,1} - \istb.[blue,dashed]{\xbox{bl}}[bl]{2,2} - \endist -\istroot[180](W)(0-3) - \istb.[green]{\xbox{ar}}[ar]{0,3} - \istb.[red]{\xbox{br}}[br]{2,1} - \endist -\istroot[-90](S)(0-4) - \istb.[dotted]{\xbox{al}}[al]{1,-1} - \istb.[green]{\xbox{ar}}[ar]{-1,1} - \endist -\istroot[0](E)(0-1) - \istb.[blue,dashed]{\xbox{bl}}[bl]{1,3} - \istb.[dotted]{\xbox{al}}[al]{2,0} - \endist -\foreach \x in {1,...,4} {\xtNode(0-\x)} -\end{scope} -\end{istgame} -\end{tcblisting} -\captionof{figure}{positioning action labels with the abbreviations}\label{fig:actlabel3} - - -In Figure~\ref{fig:actlabel3}, \fbox{$al$}'s are put in the same position from dotted branches, -and so are the other labels from their corresponding branches, like \fbox{$bl$}'s from the blue dashed branches. - -\mbigskip1 - -You can also use \icmd{\xtALShift} to put and push labels horizontally and vertically. (This is experimental!) - -\begin{tcblisting}{listing only} -% syntax: - \xtALShift{}{} -% defaults: - {1pt}{2pt} -\end{tcblisting} - -\mbigskip1 - -When the dimensions get bigger than the defaults (\xw{1pt} and \xw{2pt}) the labels get closer to the mid points of the corresponding branches, and when the numbers get smaller the labels get farther from their branches. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: node owner -\begin{istgame} -\xtALShift{4pt}{3pt} -\istroot(0){Child} % default: - \istb{A}[al] \istb{B}[ar] \endist -\istroot(1)(0-2)<45>{Parent} - \istb{L}[al] \istb{R}[ar] \endist -\end{istgame} -\end{tcblisting} - - -\subsection{Fine-tuning positions: payoffs} - -You can change the position of payoffs with \tikz{} options: \xw{xshift} and \xw{yshift}. -For example, you can do as shown in the following: - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example: payoffs -\begin{istgame} -\istroot(0) - \istb{Good}[l]{0,2} \istb{Bad} \endist -\istroot(1)(0-2) - \istb{\alpha}[al]{(1,1)}[[xshift=-10pt]below] - \istb{\beta}[ar]{-1,-1}[[yshift=-10pt]below] - \endist -\end{istgame} -\end{tcblisting} - - -\section{Growing direction of trees} -\label{sec:growing} - -You can draw a game tree that grows in any direction. -By default, a game tree grows down and the \xw{child} branches are arranged and named counterclockwise with respect to their parent node. -When a tree grows down, the branches are arranged from left to right. -When a tree grows to the right, the branches are arranged and named from below to above. - -\mbigskip1 -Sometimes you may want a tree with the branches arranged clockwise with respect to their parent node because it seems to look more natural, especially when a tree grows north or east. -In \tikz, \xw{grow'=} enables you to draw a tree developed clockwise. - -To deal with the direction of the tree growth and the order of arranging branches, this package provides \icmd{\setistgrowdirection'} as well as \icmd{\setistgrowdirection}. - -\mbigskip1 -\begin{tcblisting}{listing only} -% default: growing south counterclockwise -\def\xtgrow{grow} -\def\istdefault@grow{south} % tree growing direction - -% \setistgrowdirection(') -\NewDocumentCommand\setistgrowdirection{t'm} -{\IfBooleanTF {#1} - { \renewcommand\xtgrow{grow'} - \renewcommand\istdefault@grow{#2} - } - { \renewcommand\xtgrow{grow} - \renewcommand\istdefault@grow{#2} - } -} -\end{tcblisting} - - -\subsection{\protect\cmd{\setistgrowdirection} -- counterclockwise} - -Our first example is a tree drawn using the default values: growing \xw{south} with branches going \ixw{counterclockwise} with respect to their parent nodes (from left to right). - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 1: \setistgrowdirection{south} -\begin{istgame} -\setistOvalNodeStyle{.6cm} -\xtShowEndPoints[oval node] -\istrooto(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtdistance{12.5mm}{11.5mm} -\istrooto(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] \endist -\end{istgame} -\end{tcblisting} - -By default or with \cmd{\setistgrowdirection\{south\}}, the numbers written in the child nodes increase counterclockwise with respect to their parent nodes. - -\subsection{\protect\cmd{\setistgrowdirection'} -- clockwise} - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 2: \setistgrowdirection'{south} -\begin{istgame} -\setistgrowdirection'{south} -% same code as in Example 1 -\setistOvalNodeStyle{.6cm} -\xtShowEndPoints[oval node] -\istrooto(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtdistance{12.5mm}{11.5mm} -\istrooto(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] \endist -\end{istgame} -\end{tcblisting} - -With \cmd{\setistgrowdirection'\{south\}}, the numbers written in the child nodes increase \ixw{clockwise} with respect to their parent nodes, which does not look natural. - -\subsection{Examples of rotating trees with \protect\cmd{\setistgrowdirection(')}} - -This macro allows you to to rotate a game tree. - -When you rotate a game tree to the north or to the east, it is a good idea to use the swap version \icmd{\setistgrowdirection'}. - - -\mbigskip1 - -\noindent\textbf{Tips:} \label{page:growtips} - -Though it is not necessary, it is suggested to use the following combinations of the macros and the directions. - -\xw{\setistgrowdirection\{south\}}: branches going counterclockwise (from left to right)\par -\xw{\setistgrowdirection\{west\}}: branches going counterclockwise (downward)\par -\xw{\setistgrowdirection'\{north\}}: branches going clockwise (from left to right)\par -\xw{\setistgrowdirection'\{east\}}: branches going clockwise (downward) - -\subsubsection{A tree growing east -- counterclockwise} - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 3: \setistgrowdirection{east} -\begin{istgame} -\setistgrowdirection{east} -% same code as in Example 1 -\setistOvalNodeStyle{.6cm} -\xtShowEndPoints[oval node] -\istrooto(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtdistance{12.5mm}{11.5mm} -\istrooto(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] \endist -\end{istgame} -\end{tcblisting} - -Numbers increase upward (or counterclockwise). - -\subsubsection{A tree growing east -- clockwise} - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 4: \setistgrowdirection'{east} -\begin{istgame} -\setistgrowdirection'{east} -% same code as in Example 1 -\setistOvalNodeStyle{.6cm} -\xtShowEndPoints[oval node] -\istrooto(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtdistance{12.5mm}{11.5mm} -\istrooto(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] \endist -\end{istgame} -\end{tcblisting} - -Here, numbers increase downward (or clockwise). -This looks more natural. - -\subsubsection{A tree growing north -- counterclockwise} - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 5: \setistgrowdirection{north} -\begin{istgame} -\setistgrowdirection{north} -% same code as in Example 1 -\setistOvalNodeStyle{.6cm} -\xtShowEndPoints[oval node] -\istrooto(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtdistance{12.5mm}{11.5mm} -\istrooto(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] \endist -\end{istgame} -\end{tcblisting} - -Numbers increase from right to left (or counterclockwise). - -\subsubsection{A tree growing north - clockwise} - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} -% Example 6: \setistgrowdirection'{north} -\begin{istgame} -\setistgrowdirection'{north} -\setistOvalNodeStyle{.6cm} -\xtShowEndPoints[oval node] -\xtdistance{12.5mm}{11.5mm} -\istrooto(0){0}+{12.5mm}..{3.45cm}+ - \istb \istb \endist -\xtdistance{12.5mm}{11.5mm} -\istrooto(1)(0-1){1} - \istb{}{3}[center] \istb{}{4}[center] - \istb{}{5}[center] \endist -\istrooto(2)(0-2){2} - \istb{}{6}[center] \istb{}{7}[center] \endist -\end{istgame} -\end{tcblisting} - -Numbers increase from left to right (or clockwise). -This looks more natural. - -\subsubsection{\protect\cmd{\setistgrowkey} for one simple tree} - -\icmd{\setistgrowkey} can be used to change the key between \xw{grow} and \xw{grow'}, which is useful especially for one simple tree, not a whole tree. - - -\begin{tcblisting}{listing only} -% \setistgrowkey: definition -\NewDocumentCommand\setistgrowkey{m} -{ \renewcommand\xtgrow{#1} -} -% #1 is either grow or grow' -\end{tcblisting} - -In the following example, by using \cmd{\setistgrowdirection'} the branches are arranged clockwise. -So you will need to use \cmd{\setistgrow\{grow\}} to locally get back to `counterclockwise.' - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: using \setistgrowdirection' (swap version) -\begin{istgame} -\setistgrowdirection'{east} -\istroot(0) - \istb{a}[al] \istb{b}[bl] \endist -\istroot[north](1)(0-1) - \istb{c}[bl] \istb{d}[br] \endist -{\setistgrowkey{grow} -\istroot[south](2)(0-2) - \istb{e}[al] \istb{f}[ar] \endist -} -\istroot(3)(2-2) - \istb{g}[al] \istb{h}[bl] \endist -\end{istgame} -\end{tcblisting} - -You can do the same thing by using \cmd{\setistgrowdirection} and \cmd{\istroot'}. See the following example, in which -you do not need to use \cmd{\setistgrowkey}. - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: using \istroot' (swap version) -\begin{istgame} -\setistgrowdirection{east} -\istroot'(0) - \istb{a}[al] \istb{b}[bl] \endist -\istroot'[north](1)(0-1) - \istb{c}[bl] \istb{d}[br] \endist -\istroot[south](2)(0-2) - \istb{e}[al] \istb{f}[ar] \endist -\istroot'(3)(2-2) - \istb{g}[al] \istb{h}[bl] \endist -\end{istgame} -\end{tcblisting} - - -\section{Information sets} - -\label{sec:infoset} - -\subsection{Information sets: \protect\cmd{\xtInfoset(')}} - -The macro \icmd{\xtInfoset} draws an information set, connecting two decision nodes. - -\begin{tcblisting}{listing only} -% \xtInfoset -% syntax: from left to right -\xtInfoset[]()(){}[,] -% defaults: -[semithick,dotted]()(){}[above] -\end{tcblisting} - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \xtInfoset -\begin{istgame} -\istroot(0){1}+15mm..30mm+ - \istb{a} \istb{b} \endist -\istroot(1)(0-1) - \istb{c} \istb{d} \endist -\istroot(2)(0-2) - \istb{c'} \istb{d'} \endist -\xtInfoset(1)(2){2} -\end{istgame} -\end{tcblisting} - -\mbigskip1 -The swap version \icmd{\xtInfoset'} is provided, which is not very interested. - -\begin{tcblisting}{listing only} -% \xtInfoset' (from right to left) -% syntax: -\xtInfoset'[]()(){}[,] -% defaults: -[semithick,dotted]()(){}[above] -\end{tcblisting} - -\cmd{\xtInfoset'} connects two nodes from the coordinate \xw{()} to the coordinate \xw{()}, while \cmd{\xtInfoset} from the coordinate \xw{()} to the coordinate \xw{()}. So, basically, the two macros give the same result, without arrow tips. - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \xtInfoset' -\begin{istgame} -\setistgrowdirection'{east} -\istroot(0){1}+15mm..30mm+ - \istb{a} \istb{b} \endist -\istroot(1)(0-1) - \istb{c} \istb{d} \endist -\istroot(2)(0-2) - \istb{c'} \istb{d'} \endist -\xtInfoset'[->,very thick,red](1)(2){2}[left,blue] -\end{istgame} -\end{tcblisting} - - -\subsection{Information sets: \protect\cmd{\xtInfosetO(')} (experimental)} - -The oval version \icmd{\xtInfosetO} prints a bubble type information set. (experimental!) - - -\begin{tcblisting}{listing only} -% \stInfosetO (from left to right) -% syntax: -\xtInfosetO[]()(){}[,]() -\end{tcblisting} - -\cmd{\xtInfosetO} prints a dotted rectangle with rounded corners, connecting two nodes. -The size of the information set can be changes by the \xw{()} option, whose default value is \xw{4pt}. - - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \setistgrowdirection{south} -- default -\begin{istgame} -\istroot(0){1}+15mm..30mm+ - \istb{a} \istb{b} \endist -\istroot(1)(0-1) - \istb{c} \istb{d} \endist -\istroot(2)(0-2) - \istb{c'} \istb{d'} \endist -\xtInfosetO(1)(2){2} -\end{istgame} -\end{tcblisting} - - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \setistgrowdirection'{east} -\begin{istgame} -\setistgrowdirection'{east} -\istroot(0){1}+15mm..30mm+ - \istb{a} \istb{b} \endist -\istroot(1)(0-1) - \istb{c} \istb{d} \endist -\istroot(2)(0-2) - \istb{c'} \istb{d'} \endist -\xtInfosetO(1)(2){2} -\end{istgame} -\end{tcblisting} - -You can change the color or the size of the information set by using options, as shown in the following example: - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \setistgrowdirection'{north} -\begin{istgame} -\setistgrowdirection'{north} -\istroot(0){1}+15mm..30mm+ - \istb{a} \istb{b} \endist -\istroot(1)(0-1) - \istb{c} \istb{d} \endist -\istroot(2)(0-2) - \istb{c'} \istb{d'} \endist -\xtInfosetO[fill=blue!20](1)(2){2}(6pt){1pt} -\end{istgame} -\end{tcblisting} - - -\mbigskip2 - -The swap version \icmd{\xtInfosetO'} is also provided, which you should be aware of. - -\begin{tcblisting}{listing only} -% \xtInfosetO' (from right to left) -% syntax: -\xtInfosetO'[]()(){}[,]() -% defaults: -[semithick,densely dotted]()(){}[](4pt) -\end{tcblisting} - -When do we need the swap version \cmd{\xtInfosetO'}? -Let's look at the following example, where you would not be satisfied with how the information sets look. - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \setistgrowdirection{north} -\begin{istgame} -\setistgrowdirection{north} -\istroot(0){1}+15mm..30mm+ - \istb{a} \istb{b} \endist -\istroot(1)(0-1) - \istb{c} \istb{d} \endist -\istroot(2)(0-2) - \istb{c'} \istb{d'} \endist -\xtInfosetO(1)(2){2} -\xtInfosetO'(1-1)(1-2){1}(6pt) -\end{istgame} -\end{tcblisting} - - -The rule of thumb for using \cmd{\xtInfosetO'} is this: whenever the bubbled information set turns out to be short, -use the swap version. You can use \cmd{\xtInfosetO} and \cmd{\xtInfosetO'} interchangeably, to get correct results. - -More precisely, if you follow the tips about the combinations of \cmd{\setistgrowdirection(')} and the compass directions, as suggested on page \pageref{page:growtips}, you will get correct results. -However, if you use the combinations other than the suggestions, you will probably get the short information set. Then, use \cmd{\xtInfosetO'}. - -%\clearpage - -\section{Continuum of branches} - -The package \pkg{istgame} provides two types of macros to represent a \ixw{continuum of branches}: \cmd{\istcntm} and \cmd{\istcntmarc}. Each of the two macros, basically, works like \cmd{\istroot}, but just draws a background to express a continuum of branches. - -\subsection{\protect\cmd{\istcntm} (standard version)} - -\subsubsection{Basics} - -The first type macro \icmd{\istcntm} is the standard version. This, in fact, draws a background with the optional color filled representing a continuum of branches (the default color is \verb|black!25|). -The shape of the background is a isosceles triangle, with the height of \icmd{\cntmlevdist} (\xw{8mm} by default) and the base of \icmd{\cntmsibdist} (initially \xw{3*8mm} or \xw{24mm} by default). - - -\begin{tcblisting}{listing only} -% \istcntm -% syntax: -\istcntm[]()()[]+..+ -% defaults: -[south]()(0,0)[black!25]+8mm..3*8mm+ -\end{tcblisting} - -%\mbigskip1 - -Using \cmd{\istroot} with \cmd{\istcntm} draws a representative branch of a continuum of branches. -Note, in the following example, that the second branch of \cmd{\istroot} is \xw{missing} to express the representative branch among a continuum of branches. Again, \cmd{\cntmlevdist} is \xw{8mm} by default. - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \istcntm -\begin{istgame}[scale=1.2] -\istcntm(ctm) -\istroot(0)(ctm){I}+\cntmlevdist..\cntmlevdist+ - \istb{x}[r] \istb \endist -\xtdistance{10mm}{20mm} -\istroot(1)(0-1)<[label distance=-3pt]120>{II} - \istb{Y}[al]{x,1-x} \istb{N}[ar]{0,0} \endist -\end{istgame} -\end{tcblisting} - - -\subsubsection{Changing the size and the color of a continuum of branches} - -You can change the height (or the level distance) and the base (or the sibling distance) of the background isosceles triangle by specifying them, for example, like \xw{+10mm..20mm+}. - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \istcntm (changing the size) -\begin{istgame} -\istcntm(cntm)+10mm..20mm+ -\istroot(0)(cntm){1}+10mm..10mm+ - \istb \istb{x}[l] \endist -\end{istgame} -\end{tcblisting} - -Once the distances are type in as options of \cmd{\istcntm}, they internally change the default values, which apply only to the corresponding triangle. -For example, \xw{+10mm..20mm+} will result in \cmd{\cntmlevdist=10mm} and \cmd{\cntmsibdist=20mm}. -So you can get exactly the same result as previous one by doing the following: - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \istcntm (changing the size) -\begin{istgame} -\istcntm(cntm)+10mm..20mm+ -\istroot(0)(cntm){1}+\cntmlevdist..\cntmlevdist+ - \istb \istb{x}[l] \endist -\end{istgame} -\end{tcblisting} - -You can change the color of the background triangle by using an option as you can see in the following example: - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -\begin{istgame} -\xtdistance{10mm}{20mm} -\istroot(0){1} - \istb{A}[al] \istb{B}[ar]{1,1} \endist -\istcntm(cntm)(0-1)[green]+10mm..20mm+ -\istroot(1)(cntm)<135>{2}+\cntmlevdist..\cntmlevdist+ - \istb \istb{x}[l] \endist -\istroot(2)(1-2)<[label distance=-4pt]45>{1} - \istb{Y}[l]{3-x,x} \istb{N}[r]{0,0} \endist -\end{istgame} -\end{tcblisting} - - - -\subsection{\protect\cmd{\istcntmarc} (arc version)} - -The second type macro \icmd{\istcntmarc} is the arc version, which draws a background of two branches connected with an arc to represent a continuum of branches. - -\begin{tcblisting}{listing only} -% \istcntmarc -% syntax: -\istcntmarc[]()()[]{}+levdist..sibdist+ -% defaults: -[south]()(0,0)[bend right]{.5}+8mm..3*8mm+ -\end{tcblisting} - -The option \xw{} (\xw{0.5} by default) specifies -the convex combination of the root and each of the background child nodes. -The smaller \xw{} is, the closer is the connecting arc to the root. - - -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \istcntmarc -\begin{istgame}[scale=1.2] -\istcntmarc(ctm) -\istroot(0)(ctm){I}+\cntmlevdist..\cntmlevdist+ - \istb{x}[r] \istb \endist -\xtdistance{10mm}{18mm} -\istroot(1)(0-1)<[label distance=-3pt]120>{II} - \istb{Y}[al]{x,1-x} \istb{N}[ar]{0,0} \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -You can also change the line style and the curvature of the arc by options such as \xw{very thick}, \xw{red}, \xw{dotted}, and \xw{bend right=45}. - - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \istcntmarc -\begin{istgame}[scale=1.2] -\istcntmarc(ctm)[bend right=45,very thick,red,dotted]{.65} -\istroot(0)(ctm){I}+\cntmlevdist..\cntmlevdist+ - \istb{x}[r] \istb \endist -\xtdistance{10mm}{18mm} -\istroot(1)(0-1)<[label distance=-3pt]120>{II} - \istb{Y}[al]{x,1-x} \istb{N}[ar]{0,0} \endist -\end{istgame} -\end{tcblisting} - -You can change the length of background branches connected by an arc in the same manner as used in \cmd{\istcntm}. - - -\subsection{Examples} - -In the following example, the base angle of the background isosceles triangle is 30\textdegree. - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: \istcntm and \istcntmarc -\begin{istgame}[scale=1.2] -\istcntm(period1)[green]+8mm..2*sqrt(3)*8mm+ -\istroot(0)(period1){I}+\cntmlevdist..\cntmlevdist+ - \istb{x}[r] - \istb - \endist -\xtdistance{10mm}{20mm} -\istroot(1)(0-1)<[label distance=-3pt]120>{II} - \istb{Y}[al]{x,1-x} - \istb{N}[ar] - \endist -%--------------------------------------------------------- -\istcntmarc(period2)(1-2)% - [thick,dashed,red]+8mm..2*sqrt(3)*8mm+ -\istroot(2)(period2){II}+\cntmlevdist..\cntmlevdist+ - \istb{y}[r] - \istb - \endist -\xtdistance{10mm}{20mm} -\istroot(3)(2-1)<[label distance=-3pt]120>{I} - \istb{Y}[al]{1-y,y} - \istb{N}[ar]{0,0} - \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -You can also rotate a tree with a continuum of branches. -When it is necessary, you should use \xw{[bend left]} to get a correct result as shown in the following example: - -\begin{tcblisting}{listing outside text, righthand width=.25\linewidth} -% Example: tree growing east -\begin{istgame}[scale=1.2] -\setistgrowdirection'{east} -\istcntm(period1)[green]+8mm..2*sqrt(3)*8mm+ -\istroot(0)(period1)<180>{I}+\cntmlevdist..\cntmlevdist+ - \istb{x}[b] - \istb - \endist -\xtdistance{10mm}{20mm} -\istroot(1)(0-1)<[label distance=-3pt]120>{II} - \istb{Y}[al]{x,1-x} - \istb{N}[bl] - \endist -%--------------------------------------------------------- -\istcntmarc(period2)(1-2)% - [bend left=45,thick,dashed,red]+8mm..2*sqrt(3)*8mm+ -\istroot(2)(period2)<180>{II}+\cntmlevdist..\cntmlevdist+ - \istb{y}[b] - \istb - \endist -\xtdistance{10mm}{20mm} -\istroot(3)(2-1)<[label distance=-3pt]120>{I} - \istb{Y}[al]{1-y,y} - \istb{N}[bl]{0,0} - \endist -\end{istgame} -\end{tcblisting} - - -\section{Auxiliary macros} - -\label{sec:auxmac} - -The \pkg{istgame} package also provides some auxiliary macors, which enable you to add players, action labels, payoffs, and others to your tree. - -\begin{description}\tightlist -\item -\icmd{\xtInfosetOwner} is an auxiliary tool for putting the owner of an information set. -\item -\icmd{\xtActionLabel} is an auxiliary tool for putting an action label to a branch. -\item -\icmd{\xtOwner} is an auxiliary tool for putting the owner of a node (or a player). -\item -\icmd{\xtPayoff} is an auxiliary tool for putting payoffs. -\item -\icmd{\xtNode} is another tool for putting `something' into a node. This `something' could be the owner of a node. -\item -\icmd{\xtNode*} puts `something' into a \ixw{plain node}. -\end{description} - -syntax: \xw{\xtInfosetOwner()(){}[,]} - -syntax: \xw{\xtActionLabel()(){}[,]} - -syntax: \xw{\xtOwner(){}[,]} - -syntax: \xw{\xtPayoff(){}[,]} - -syntax: \xw{\xtNode[]()[,]\{owner\}} - -syntax: \xw{\xtNode*()\{owner\}} - -\mbigskip1 -The auxiliary macros depend on the coordinates defined in the sequence of \cmd{\istroot}--\cmd{\istb}--\cmd{\endist} and print their corresponding objects on or around the specified coordinates. -So, in the above auxiliary macros, all the coordinates such as \xw{()}, \xw{()}, and \xw{()} are mandatory arguments. - -\begin{tcblisting}{} -% Example: auxiliary macros -\begin{istgame}[scale=2] -\istroot(0)[chance node] - \istb[dashed]{A} - \istb* - \istb*[blue,very thick]{B}[right,xshift=2pt,yshift=2pt,red] - \endist -\xtInfosetO(0)(0)(2.5pt) -\xtInfoset[thick](0-1)(0-2){1} -\xtInfosetO[thick,red](0-2)(0-3){2} -\xtInfoset[dashed,bend right=25](0-1)(0-3) -%----------------- -\xtActionLabel(0)(0-3){\epsilon}[bl] % action label in math mode -\xtInfosetOwner(0-1)(0-3){3}[xshift=-25pt,yshift=-25pt] -\xtOwner(0){Nash}[xshift=-5pt,left] -\xtPayoff(0-3){(u_1,u_2)}[right,xshift=5pt] % payoffs in math mode -\xtNode[dotted](0-1)[box node,fill=blue!20]{Smith} -%----------------- -\istroot[east](a)(0)[chance node] - \istb \endist -\xtNode*(a-1){text} -\end{istgame} -\end{tcblisting} - -To specify the \xw{[]} option for the above auxiliary macros (other than \cmd{\xtNode}), -you can use the abbreviations -\xw{[l]}, \xw{[r]}, \xw{[a]}, \xw{[b]}, \xw{[al]}, \xw{[ar]}, \xw{[bl]}, and \xw{[br]}. -Each of these abbreviations works only when used alone without any other option keys within brackets. -For example, the option \xw{[b]} or \xw{[below]} or \xw{[below,xshift=5pt]} works, but not \xw{[b,xshift=5pt]}. - -\mbigskip1 - -\begin{tcblisting}{listing above text, righthand width=.3\linewidth,breakable} -% Example: -\begin{istgame}[font=\scriptsize] -\xtdistance{10mm}{20mm} -\istcntm(ctm) % period 1 -\istroot(1)(ctm){1}+\cntmlevdist..10mm+ - \istb{x}[r] - \istb - \endist -\istroot(A1)(1-1)<[label distance=-3pt]135>{2} - \istb{A}[al]{x,1-x} - \istb{R}[ar] - \endist -\xtOwner(1){period 1}[xshift=30mm] -\istcntm(ctm)(A1-2) % period 2 -\istroot(2)(ctm){2}+\cntmlevdist..10mm+ - \istb{y}[r] - \istb - \endist -\istroot(A2)(2-1)<[label distance=-3pt]135>{1} - \istb{A}[al]{1-y,y} - \istb{R}[ar] - \endist -\xtOwner(2){period 2}[xshift=25mm] -\xtPayoff(A2-1){\left(\makecell{\delta\\\delta}\right)\cdots}[below,xshift=-40pt] -\istcntm(ctm)(A2-2) % period 3 -\istroot(3)(ctm){1}+\cntmlevdist..10mm+ - \istb{x}[r] - \istb - \endist -\istroot(A3)(3-1)<[label distance=-3pt]135>{2} - \istb{A}[al]{x,1-x} - \istb{R}[ar]{0,0} - \endist -\xtOwner(3){period 3}[xshift=20mm] -\xtPayoff(A3-1){\left(\makecell{\delta^2\\\delta^2}\right)\cdots}[below,xshift=-50pt] -\end{istgame} -\end{tcblisting} - -%\subsection{More supplement macros} -% -%\indent\indent -%syntax: \xw{\xtShowEndPoints[]} -% -%syntax: \xw{\xtHideEndPoints[]} -% -%syntax: \xw{\xtShowTerminalNodes[]} % work with \istb. -% -%syntax: \xw{\xtHideTerminalNodes[]} -% -%\mbigskip2 -% -%\icmd{\xtShowEndPoints} is to control the node shape of every endpoint of every simple tree. -%(For more details, see page \pageref{page:endpoint}.) -% -%\icmd{\xtHideEndPoints} turns off the effect of \cmd{\xtShowEndPoints}. -% -%\icmd{\xtShowTerminalNodes} works only with \cmd{\istb.}\@ to control the node shape of terminal nodes. -%(For more details, see page \pageref{page:terminalnode}.) -% -%\icmd{\xtHideTerminalNodes} turns off the effect of \cmd{\xtShowTerminalNodes}. - -\section{Representing subgames} - -Here is an example of a whole game tree. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth,breakable} -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] \istb{D}[r] \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] \istb{R}[ar] \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} \istb{r}[ar]{(1,1)} \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} \istb{r}[ar]{(0,3)} \endist -\end{istgame} -\end{tcblisting} - -\subsection{\protect\cmd{\xtSubgameBox(*)} (experimental)} - -\subsubsection{\protect\cmd{\xtSubgameBox}} - -\icmd{\xtSubgameBox} is for indicating a \ixw{subgame} by a box (or a rectangle) with rounded corners. - -\begin{tcblisting}{listing only} -% \xtSubgameBox(*) -% syntax: - \xtSubgame(*)(){() () ... }[] -% options: - *: filled box - (): the subroot of a subgame (mandatory) - {(coor1) (coor2) ...}: coordinates of terminal nodes (mandatory) - []: color, line style -% defaults: - (){}[rectangle,dashed,inner sep=20pt,rounded corners=15pt,black!50] - *(){}[rectangle,inner sep=20pt,rounded corners=15pt,red!20] -\end{tcblisting} - - -%\begin{tcblisting}{listing only} -%% \xtSubgameBox(*) -%% syntax: -% \xtSubgame(*)(){() () ... }[] -%%% \xtSubgameBox: definition -%\def\xtdefaultsubrootshiftoval{0,-.3} -%\NewDocumentCommand\xtSubgameBox{ s r() m O{} } -%{ \IfBooleanTF #1 -% { -% \coordinate (xtsubroot) at ($(#2)+(\xtdefaultsubrootshiftoval)$); -% \begin{scope}[on background layer] -% \node [rectangle,fill=red!20,inner sep=20pt,rounded corners=15pt,#4] -% [fit=(xtsubroot) #3] {}; -% \end{scope} -% } -% { -% \coordinate (xtsubroot) at ($(#2)+(0,-.3)$); -% \begin{scope}[on background layer] -% \node [rectangle,draw,dashed,inner sep=20pt,rounded corners=15pt,black!50,#4] -% [fit=(xtsubroot) #3] {}; -% \end{scope} -% } -%} -%\end{tcblisting} - - -The subgame box embraces the subroot indicated in parentheses and terminal nodes specified within curly braces. -The coordinates of terminal nodes are listed in curly braces without delimiters (spaces are allowed). -The default options for the subgame box are \xw{dashed}, \xw{inner sep=20pt}, \xw{rounded corners=15pt}, and \xw{black!50}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth,breakable} -% subgame: rectangle -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] \istb{D}[r] \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] \istb{R}[ar] \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} \istb{r}[ar]{(1,1)} \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} \istb{r}[ar]{(0,3)} \endist -\xtSubgameBox(1){(2-1)(3-2)} -\xtSubgameBox(2){(2-1)(2-2)}[solid,blue] -\end{istgame} -\end{tcblisting} - -You can change the size of the box in two ways. -First, you can change it by using \xw{inner sep}, \xw{inner xsep}, or \xw{inner ysep}. Secondly, you can shift the subroot, like \xw{([xshift=5pt]1)} when the subroot is \xw{(1)}. -Of course, you can do the both at the same time. - -% subgame: rectangle (inner sep,yshift) -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth,breakable} -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] \istb{D}[r] \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] \istb{R}[ar] \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} \istb{r}[ar]{(1,1)} \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} \istb{r}[ar]{(0,3)} \endist -\xtSubgameBox(1){(2-1)(3-2)} -\xtSubgameBox([yshift=5pt]2){(2-1)(2-2)}% - [solid,blue,inner sep=10pt] -\end{istgame} -\end{tcblisting} - - -\subsubsection{\protect\cmd{\xtSubgameBox*}} - -The starred version \icmd{\xtSubgameBox*} produces a subgame box with background color (by default \xw{red!20}). -In the following example, where the tree grows east, the size of the filled subgame box is adjusted by manipulating \xw{inner sep} and \xw{xshift}. - -\begin{tcblisting}{listing outside text, righthand width=.3\linewidth,breakable} -% subgame: rectangle* -\begin{istgame} -\setistgrowdirection'{east} -\xtdistance{15mm}{30mm} -\istroot[45](0)[initial node]<180>{1} - \istb{A}[l]{(2,2)}[a] \istb{D}[b] \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] \istb{R}[bl] \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} \istb{r}[bl]{(1,1)} \endist -\istroot(3)(1-2)<-135>{2} - \istb{\ell}[al]{(3,2)} \istb{r}[bl]{(0,3)} \endist -\xtSubgameBox*([xshift=20pt]1){(2-1)(3-2)}% - [inner xsep=30pt] -\end{istgame} -\end{tcblisting} - - -\subsection{\protect\cmd{\xtSubgameOval(*)} (experimental)} - -\icmd{\xtSubgameOval} and \icmd{\xtSubgameOval*} are also provided. - -\begin{tcblisting}{listing only} -% \xtSubgameOval(*) -% syntax: - \xtSubgameOval(*)(){() () ... }[] -% options: - *: filled box - (): the subroot of a subgame (mandatory) - {(coor1) (coor2) ...}: coordinates of terminal nodes (mandatory) - []: color, line style -% defaults: - (){}[ellipse,dashed,inner sep=20pt,rounded corners=15pt,black!50] - *(){}[ellipse,inner sep=20pt,rounded corners=15pt,red!20] -\end{tcblisting} - - -%\begin{tcblisting}{listing only} -%% \xtSubgameOval(*) -%% syntax: -% \xtSubgame(*)(){() () ... }[] -%%% \xtSubgameOval: definition -%\def\xtdefaultsubrootshiftoval{0,-.7} -%\DeclareDocumentCommand\xtSubgameOval{ s r() m O{}} -%{ \IfBooleanTF #1 -% { -% \coordinate (xtsubroot) at ($(#2)+(\xtdefaultsubrootshiftoval)$); -% \begin{scope}[on background layer] -% \node [ellipse,fill=red!20,inner sep=15pt,#4] -% [fit=(xtsubroot) #3] {}; -% \end{scope} -% } -% { -% \coordinate (xtsubroot) at ($(#2)+(0,-.7)$); -% \begin{scope}[on background layer] -% \node [ellipse,draw,dashed,inner sep=15pt,black!50,#4] -% [fit=(xtsubroot) #3] {}; -% \end{scope} -% } -%} -%\end{tcblisting} - -\cmd{\xtSubgameOval(*)} works just like \cmd{\xtSubgameBox(*)}, except for one thing: an oval instead of a rectangle. -\cmd{\xtSubgameOval} draws an oval (or an ellipse) to represent a subgame, and \cmd{\xtSubgameOval*} draws a filled oval with \xw{red!20} by default. - - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% subgame: ellipse -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] - \istb{D}[r] - \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} - \istb{r}[ar]{(0,3)} - \endist -\xtSubgameOval(1){(2-1)(3-2)} -\xtSubgameOval(2){(2-1)(2-2)} -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -The way of changing the size of the subgame oval is the same as with \cmd{\xtSubgameBox}: first, changing inner sep, and secondly, shifting the subroot. -In the following example, the options \xw{inner xsep=25pt} and \xw{([xshift=30pt]1)} are used to change the size of the subgame oval. Its color is changed by \xw{blue!20}. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% subgame: ellipse* -\begin{istgame} -\setistgrowdirection'{east} -\xtdistance{15mm}{30mm} -\istroot[45](0)[initial node]<180>{1} - \istb{A}[l]{(2,2)}[a] - \istb{D}[b] - \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] - \istb{R}[bl] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[bl]{(1,1)} - \endist -\istroot(3)(1-2)<-135>{2} - \istb{\ell}[al]{(3,2)} - \istb{r}[bl]{(0,3)} - \endist -\xtSubgameOval*([xshift=30pt]1){(2-1)(3-2)}% - [inner xsep=25pt,blue!20] -\end{istgame} -\end{tcblisting} - -\subsection{More examples} - -You can change the shape of a subgame repesentation to other shapes such as \xw{semicircle} and \xw{circle} or even \xw{star}. You will need to change the size of the shape by using \xw{inner sep} and by shifting the subroot to get the result you want. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% subgame: half circle -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] - \istb{D}[r] - \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} - \istb{r}[ar]{(0,3)} - \endist -\xtSubgameBox([yshift=-2cm]1){(2-1)(3-2)}% - [semicircle,inner sep=15pt] -\end{istgame} -\end{tcblisting} - - -%\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -%% subgame: half circle* -%\begin{istgame} -%\setistgrowdirection'{east} -%\xtdistance{15mm}{30mm} -%\istroot[45](0)[initial node]<180>{1} -% \istb{A}[l]{(2,2)}[a] -% \istb{D}[b] -% \endist -%\istroot(1)(0-2)<135>{1} -% \istb{L}[al] -% \istb{R}[bl] -% \endist -%\xtdistance{10mm}{20mm} -%\istroot(2)(1-1)<135>{2} -% \istb{\ell}[al]{(4,2)} -% \istb{r}[bl]{(1,1)} -% \endist -%\istroot(3)(1-2)<-135>{2} -% \istb{\ell}[al]{(3,2)} -% \istb{r}[bl]{(0,3)} -% \endist -%\xtSubgameBox*([xshift=2cm]1){(2-1)(3-2)}% -% [semicircle,rotate=90,inner sep=0pt] -%\end{istgame} -%\end{tcblisting} - -Here is one more example, which shows how to draw a rectangle and circles to represent subgames. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% subgame: rectangle* -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] - \istb{D}[r] - \endist -\istroot(1)(0-2)<135>{1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} - \istb{r}[ar]{(0,3)} - \endist -\xtSubgameBox*(1){(2-1)(3-2)} -\xtSubgameOval*(2){(2-1)(2-2)}% - [circle,blue!20,inner xsep=9pt] -\xtSubgameOval(3){(3-1)(3-2)}% - [circle,inner xsep=9pt] -\end{istgame} -\end{tcblisting} - - - -\section{Miscellany} - -\subsection{Various branch types, directions, and lengths} - -What follows is an example of how to deal with various line types, directions, and lengths of branches. - -\mbigskip1 -\begin{tcblisting}{breakable} -\begin{istgame} -\istroot(0)[chance node]<[blue]>{N}+10mm..30mm+ - \istb[->,shorten >=.8pt]{p}[above left,red] - \istb[->,shorten >=.8pt]{1-p}[ar] - \endist -\istroot(1)(0-1)+15mm..30mm+ - \istb{L}[al] - \istb*[->>>]{R}[ar] - \endist -\istroot(2)(0-2)+10mm..15mm+ - \istb[->,dashed]{A} - \istb[red]{a}[al]{(1,-1)}[[blue]right] - \istb*[blue,text=red,thick]{b}[ar]{(u_1,u_2)}[[green]-90] - \endist -\end{istgame} -\end{tcblisting} - - -\subsection{Code reuse} - -\subsubsection{Drawing subgames} - -Suppose that you have the following tree as a whole game. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% Example: a whole game -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] - \istb{D}[r] - \endist -\istroot(1)(0-2){1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} - \istb{r}[ar]{(0,3)} - \endist -\end{istgame} -\end{tcblisting} - - - -It is easy to draw a subgame if you use the existing codes for a whole game. -To get a subgame, just comment out the codes for the rest of the subgame. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% Example: a subgame -\begin{istgame} -\xtdistance{15mm}{30mm} -%\istroot[-135](0)[initial node]<0>{1} -% \istb{A}[a]{(2,2)}[l] -% \istb{D}[r] -%\endist -\istroot(1)(0-2){1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2)<45>{2} - \istb{\ell}[al]{(3,2)} - \istb{r}[ar]{(0,3)} - \endist -\end{istgame} -\end{tcblisting} - -\mbigskip1 - -\remark If you copy and paste the previous codes alone and try to complie to get a subgame, you will get an error message: - -\verb+! Package pgf Error: No shape named 0-2 is known.+ - -\noindent -This is because the first active \cmd{\istroot} refers to the undefined coordinate \xw(0-2). In this case you need to change the line as: - -\verb+\istroot(1)(0,0){1}+ - -\noindent -However, if you have the codes for a whole game before the codes with some lines commented out for a subgame, you will not get the error message when you compile the file (because the coordinate \xw{(0-2)} is already defined in the whole game). -Therefore, most of the time you will not get the error message by commenting out some lines to get a subgame. - -\mbigskip1 - -A smaller subgame is also easy to get by commenting out the rest of the subgame you want. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% Example: a smaller subgame -\begin{istgame} -%\xtdistance{15mm}{30mm} -%\istroot[-135](0)[initial node]<0>{1} -% \istb{A}[a]{(2,2)}[l] -% \istb{D}[r] -%\endist -%\istroot(1)(0-2){1} -% \istb{L}[al] -% \istb{R}[ar] -%\endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -%\istroot(3)(1-2)<45>{2} -% \istb{\ell}[al]{(3,2)} -% \istb{r}[ar]{(0,3)} -%\endist -\end{istgame} -\end{tcblisting} - - -It is not possible to make a subgame stay put where it appears in a whole game. -(Repalce \xw{[black!5]} with \xw{[white]} to make the rest of the game disappear in the following example.) - -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% Example: a subgame stays put -\begin{istgame} -\setistDecisionNodeStyle[black!5] -\xtdistance{15mm}{30mm} -\istroot[-135](0)%[initial node]<0>{1} - \istb[black!5]%{A}[a]{(2,2)}[l] - \istb[black!5]%{D}[r] - \endist -\istroot(1)(0-2)%{1} - \istb[black!5]%{L}[al] - \istb[black!5]%{R}[ar] - \endist -\setistDecisionNodeStyle -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -\setistDecisionNodeStyle[black!5] -\istroot(3)(1-2)%<45>{2} - \istb[black!5]%{\ell}[al]{(3,2)} - \istb[black!5]%{r}[ar]{(0,3)} - \endist -\end{istgame} -\end{tcblisting} - - - -\subsubsection{Backward induction} - -It is also easy to illustrate the procedure of backward induction, when you analyze an extensive game. -By using \cmd{\istb} with options, you can change the color and the style of a line representing a branch and an arrow tip to it. - -\mbigskip1 - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -% Example: backward induction -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb[dashed]{A}[a]{(2,2)}[l] - \istb[very thick]{D}[r] - \endist -\istroot(1)(0-2){1} - \istb[very thick]{L}[al] - \istb[dashed]{R}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-1)<135>{2} - \istb[->>>,very thick,blue]{\ell}[al]{(4,2)} - \istb[thick,dotted]{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2)<45>{2} - \istb[thick,dotted]{\ell}[al]{(3,2)} - \istb[very thick,blue]{r}[ar]{(0,3)} - \endist -\end{istgame} -\end{tcblisting} - - -%\clearpage -\subsubsection{Code reusability} - -Chen(2013)'s work is good to understand how drawing a game tree with \tikz works. - -\begin{tcblisting}{listing above text} -% Chen (2013) -\begin{tikzpicture}[scale=1,font=\footnotesize] -\tikzstyle{solid node}=[circle,draw,inner sep=1.5,fill=black] -\tikzstyle{hollow node}=[circle,draw,inner sep=1.5] -\tikzstyle{level 1}=[level distance=15mm,sibling distance=3.5cm] -\tikzstyle{level 2}=[level distance=15mm,sibling distance=1.5cm] -\tikzstyle{level 3}=[level distance=15mm,sibling distance=1cm] -\node(0)[solid node,label=above:{$P1$}]{} -child{node[solid node,label=above left:{$P2$}]{} -child{node[hollow node,label=below:{$(1,2)$}]{} edge from parent node[left]{$C$}} -child{node[hollow node,label=below:{$(1,-1)$}]{} edge from parent node[left]{$D$}} -child{node[hollow node,label=below:{$(0,2)$}]{} edge from parent node[right]{$E$}} -edge from parent node[left,xshift=-5]{$A$} -} -child{node[solid node,label=above right:{$P2$}]{} -child{node[hollow node,label=below:{$(2,2)$}]{} edge from parent node[left]{$F$}} -child{node[hollow node,label=below:{$(1,3)$}]{} edge from parent node[right]{$G$}} -edge from parent node[right,xshift=5]{$B$} -}; -\end{tikzpicture} -\end{tcblisting} - -%\mbigskip1 - -You can get a quite similar (actually the same) result by using the \pkg{istgame} package. - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -% istgame -\begin{istgame}[scale=1,font=\footnotesize] -\setistDecisionNodeStyle{4pt} -\xtdistance{15mm}{3.5cm} -\istroot(0){$P1$} -\istb{A}[al] -\istb{B}[ar] -\endist -\xtShowEndPoints[oval node] -\xtdistance{15mm}{1.5cm} -\istroot(1)(0-1)<135>{$P2$} -\istb{C}[l]{(1,2)} -\istb{D}[l]{(1,-1)} -\istb{E}[r]{0,2)} -\endist -\istroot(2)(0-2)<45>{$P2$} -\istb{F}[l]{(2,2)} -\istb{G}[r]{(1,3)} -\endist -\end{istgame} -\end{tcblisting} - - -The \pkg{istgame} package enhances simplicity and readability, and hence it is easy to reuse codes. You can easily read and modify game tree codes even if you go over them after a while. - -%\clearpage -\section{Game tree examples} - -This section provides some examples of extensive games. -Before we start, let us change the default fontsize of the \env{istgame} environment by stating -\cmd{\setistgamefontsize\{\cmd{\footnotesize\}}} outside of the environment. (Right here!) - -\setistgamefontsize{\footnotesize} - -\subsection{Simple examples} - - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -\begin{istgame}[->,>=stealth,shorten >=.8pt] -\xtdistance{15mm}{30mm} -\istroot(0)[initial node]{Child} - \istb{Good}[left]{(0,2)} - \istb{Bad}[right] - \endist -\istroot(1)(0-2)<30>{Parent} - \istb{Forgive}[left]{(1,1)} - \istb{Punish}[right]{(-1,-1)} - \endist -\end{istgame} -\end{tcblisting} - -\medskip - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -\begin{istgame} -\xtdistance{10mm}{30mm} -\istroot(0){1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtdistance{7mm}{15mm} -\istroot(1a)(0-1) - \istb{a}[al]{1,0} - \istb{b}[ar]{2,3} - \endist -\istroot(1b)(0-2) - \istb{c}[al]{0,1} - \istb{d}[ar]{-1,0} - \endist -\xtInfoset(1a)(1b){2} -\end{istgame} -\end{tcblisting} - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -\begin{istgame} -\xtShowEndPoints[oval node] -\xtdistance{10mm}{30mm} -\istroot(0){1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtdistance{7mm}{15mm} -\istroot(1a)(0-1) - \istb{a}[al]{1,0} - \istb{b}[ar]{2,3} - \endist -\istroot(1b)(0-2) - \istb{c}[al]{0,1} - \istb{d}[ar]{-1,0} - \endist -\xtInfoset[bend left=30](1a)(1b){2} -\end{istgame} -\end{tcblisting} - -\medskip - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth,breakable} -\begin{istgame} -\xtdistance{15mm}{30mm} -\istroot[-135](0)[initial node]<0>{1} - \istb{A}[a]{(2,2)}[l] - \istb{D}[r] - \endist -\istroot(1)(0-2){1} - \istb{L}[al] - \istb{R}[ar] - \endist -\xtInfosetO(1-1)(1-2){2}(6pt) -\xtdistance{10mm}{20mm} -\istroot(2)(1-1) - \istb{\ell}[al]{(4,2)} - \istb{r}[ar]{(1,1)} - \endist -\istroot(3)(1-2) - \istb{\ell}[al]{(3,2)} - \istb{r}[ar]{(0,3)} - \endist -\end{istgame} -\end{tcblisting} - - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -% IGT 218.1 (Osborne, 2004b) -\begin{istgame}[font=\normalsize] -\xtdistance{10mm}{20mm} -\istroot(0){Vote} - \istb{a}[al]{x} - \istb{b}[ar] - \endist -\istroot(1)([yshift=-1.5em]0-2){Vote} - \istb{c}[al]{y} - \istb{d}[ar]{z} - \endist -\end{istgame} -\end{tcblisting} - - - -\subsection{A game tree with a strategic game} - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -%\usepackage{tabu} -%\NewExpandableDocumentCommand\xcol{mO{c|}m} -% {\multicolumn{#1}{#2}{\ensuremath{#3}}} -\begin{istgame} -\xtdistance{10mm}{40mm} -\istroot(0)[initial node]{1} - \istb{Book}[al]{2,2} - \istb{Concert}[ar] - \endist -\xtPayoff(0-2){ - \begin{tabu}spread0pt{X[$c1]*2{|X[$c2]}|} - \xcol1[c]{~} & \xcol1[c]{B} & \xcol1[c]{S} \\\tabucline{2-} - B & 3,1 & 0,0 \\\tabucline{2-} - S & 0,0 & 1,3 \\\tabucline{2-} - \end{tabu} - } -\end{istgame} -\end{tcblisting} - - -%\clearpage - -\subsection{Larger game trees} - -\begin{tcblisting}{} -\begin{istgame} -\xtShowEndPoints -\xtdistance{10mm}{40mm} -\istroot(0)[initial node]{1} \istb \istb \istb \endist -\xtdistance{10mm}{10mm} -\istroot(1)(0-1) \istb \istb \istb \endist -\istroot(2)(0-2) \istb \istb \istb \endist -\xtdistance{10mm}{20mm} -\istroot(3)(0-3){2} \istb \istb \endist -\xtdistance{10mm}{7mm} -\istroot(a)(1-3){3} \istb \istb \istb \endist -\xtdistance{10mm}{14mm} -\istroot(b)(2-3) \istb \istb \endist -\istroot(c)(3-1) \istb \istb \endist -\istroot(d)(3-2){3} \istb \istb \endist -\xtInfoset(1)(2){2} -\xtInfosetO(2-3)(3-1){3} -\xtInfosetO(3-2)(3-2) -\end{istgame} -\end{tcblisting} - - -\begin{tcblisting}{} -\begin{istgame} -\xtdistance{10mm}{40mm} -\istroot(0)[initial node]{1} \istb \istb \istb \istb \endist -\xtdistance{10mm}{10mm} -\istroot(1)(0-1) \istb \istb \istb \endist -\istroot(2)(0-2) \istb \istb \istb \endist -\xtdistance{10mm}{20mm} -\istroot(3)(0-3){2} \istb \istb \endist -\xtdistance{10mm}{7mm} -\istroot(a)(1-3) \istb \istb \istb \endist -\istroot(b)(2-3) \istb \istb \endist -\istroot(c)(3-1) \istb \istb \istb \endist -\istroot(d)(0-4) \istb \istb \endist -\xtInfosetO(1)(2){2} -\xtInfoset[bend right=10](a)(c){3}[below,yshift=-8pt] -\xtInfoset[bend left=10](b)(d){3}[xshift=20pt,yshift=13pt] -\end{istgame} -\end{tcblisting} - - - -%\clearpage -\subsection{Tic-tac-toe (sketch)} - -% tic-tac-toe -\begin{tcblisting}{} -% tic-tac-toe (sketch) -\begin{istgame}[scale=1.7,font=\tiny] -\xtdistance{20mm}{7mm} -\istroot(0) \istb \istb \istb \istb \istb \istb{\dots} \istb \istb \istb{9}[r] \endist -\foreach \x in {1,...,4} -{\xtActionLabel(0)(0-\x){\x}[l]} -\xtdistance{10mm}{3mm} -\istroot(a1)(0-1) \istb{2}[l] \istb \istb \istb \istb \istb \istb \istb{9}[r] \endist -\istroot(a7)(0-7) \istb{1}[l] \istb \istb \istb \istb \istb \istb \istb{9}[r] \endist -\xtdistance{10mm}{2mm} -\istroot(A)(a1-3) \istb{2}[l] \istb \istb \istb \istb \istb \istb{9}[r] \endist -\istroot(B)(a1-8) \istb{2}[l] \istb \istb \istb \istb \istb \istb{8}[r] \endist -\istroot(C)(a7-8) \istb{1}[l] \istb \istb \istb \istb \istb \istb{8}[r] \endist -\istroot(Bx)(B-7) \istb{2}[l] \istb \istb \istb \istb \istb{7}[r] \endist -\istroot(By)(Bx-1) \istb{3}[l] \istb \istb \istb \istb{7}[r] \endist -\istroot(Bz)(By-1) \istb{4}[l] \istb \istb \istb{7}[r] \endist -\xtPayoff(Bz-4){\vdots} -\xtPayoff(Bz-4){\cdots}[xshift=10pt,right] -\end{istgame} -\end{tcblisting} - - -%\clearpage - -\subsection{Selten's horse} - -\begin{tcblisting}{listing outside text, righthand width=.4\linewidth} -% Selten's horse: IGT 331.2 (Osborne, 2004b) -\begin{istgame} -\xtdistance{8mm}{16mm} -\istroot[-45](0)[initial node]{1} - \istb{D}[r] - \istb{C}[a] - \endist -\istroot(1)(0-1)+10mm..20mm+ - \istb{L}[al]{3,3,2} - \istb{R}[ar]{0,0,0} - \endist -\istroot[-45](a)(0-2){2} - \istb{d}[r] - \istb{c}[a]{1,1,1}[r] - \endist -\istroot(a1)(a-1)+10mm..20mm+ - \istb{L}[al]{4,4,0} - \istb{R}[ar]{0,0,1} - \endist -\xtInfoset(1)(a1){3} -\end{istgame} -\captionof{figure}{IGT 331.2} -\end{tcblisting} - - -\subsection{Centipede game} - -\begin{tcblisting}{} -% centipede -\begin{istgame}[scale=1.5] -\setistgrowdirection{south east} -\xtdistance{10mm}{20mm} -\istroot(0)[initial node]{1} - \istb{Take}[r]{(2,0)}[b] \istb{Pass}[a] \endist -\istroot(1)(0-2){2} - \istb{Take}[r]{(1,3)}[b] \istb{Pass}[a] \endist -\istroot(2)(1-2){1} - \istb{Take}[r]{(4,2)}[b] \istb{Pass}[a] \endist -\xtInfoset(2-2)([xshift=5mm]2-2) -%------------- -\istroot(3)([xshift=5mm]2-2){2} - \istb{Take}[r]{(97,99)}[b] \istb{Pass}[a] \endist -\istroot(4)(3-2){1} - \istb{Take}[r]{(100,98)}[b] \istb{Pass}[a] \endist -\istroot(5)(4-2){2} - \istb{Take}[r]{(99,101)}[b] \istb{Pass}[a]{(100,100)}[r] \endist -\end{istgame} -\end{tcblisting} - - - -%\clearpage -\subsection{Poker game} - - -% poker -\begin{tcblisting}{} -% poker: growing south -\begin{istgame}[scale=1.7] -\xtShowEndPoints -\xtdistance{15mm}{30mm} -\istroot(0)[chance node]{N} - \istb{Black}[al] - \istb{Red}[ar] - \endist -\xtdistance{15mm}{30mm} -\istroot(1-1)(0-1){1} - \istb{Fold}[al]{1,-1} - \istb{Raise}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(1)(1-1-2) - \istb{Pass}[al]{1,-1} - \istb{Meet}[ar]{2,-2} - \endist -\xtdistance{15mm}{30mm} -\istroot(1-2)(0-2){1} - \istb{Fold}[al]{-1,1} - \istb{Raise}[ar] - \endist -\xtdistance{10mm}{20mm} -\istroot(2)(1-2-2){} - \istb{Pass}[al]{1,-1} - \istb{Meet}[ar]{-2,2} - \endist -\xtInfoset(1)(2){2} -\xtActionLabel(0)(0-1){[\frac12]}[br] -\xtActionLabel(0)(0-2){[\frac12]}[bl] -\end{istgame} -\end{tcblisting} - - -\subsection{Poker game: growing to the right} -\label{p:poker-right} - -\begin{tcblisting}{} -% poker: growing east -- counterclockwise -\begin{istgame}[scale=1.3] -\setistgrowdirection{0} % default grow-direction is 'east' from now on -\xtdistance{15mm}{30mm} -\istroot(0)[chance node]{N} - \istb{Black}[bl] - \istb{Red}[al] - \endist -\xtdistance{15mm}{30mm} -\istroot(1-1)(0-1){1} - \istb{Fold}[bl]{1,-1} - \istb{Raise}[al] - \endist -\xtdistance{12mm}{24mm} -\istroot(1)(1-1-2) - \istb{Pass}[bl]{1,-1} - \istb{Meet}[al]{2,-2} - \endist -\xtdistance{15mm}{30mm} -\istroot(1-2)(0-2){1} - \istb{Fold}[bl]{-1,1}[[xshift=5pt]below] - \istb{Raise}[al] - \endist -\xtdistance{12mm}{24mm} -\istroot(2)(1-2-2) - \istb{Pass}[bl]{1,-1} - \istb{Meet}[al]{-2,2} - \endist -\xtInfosetO'(1-1-2)(1-2-2){2} % \xtInfosetO' -\xtActionLabel(0)(0-1){[\frac12]}[ar] -\xtActionLabel(0)(0-2){[\frac12]}[br] -\end{istgame} -\end{tcblisting} - -\begin{tcblisting}{} -% poker: growing east -- clockwise (swap version) -\begin{istgame}[scale=1.3] -\setistgrowdirection'{0} % \setistgrowdirection' -\xtdistance{15mm}{30mm} -\istroot(0)[chance node]{N} - \istb{Black}[al] - \istb{Red}[bl] - \endist -\xtdistance{15mm}{30mm} -\istroot(1-1)(0-1){1} - \istb{Fold}[al]{1,-1} - \istb{Raise}[bl] - \endist -\xtdistance{12mm}{24mm} -\istroot(1)(1-1-2) - \istb{Pass}[al]{1,-1} - \istb{Meet}[bl]{2,-2} - \endist -\xtdistance{15mm}{30mm} -\istroot(1-2)(0-2){1} - \istb{Fold}[al]{-1,1} - \istb{Raise}[bl] - \endist -\xtdistance{12mm}{24mm} -\istroot(2)(1-2-2) - \istb{Pass}[al]{1,-1} - \istb{Meet}[bl]{-2,2} - \endist -\xtInfosetO[fill=red!20](1-1-2)(1-2-2){2} -\xtActionLabel(0)(0-1){[\frac12]}[br] -\xtActionLabel(0)(0-2){[\frac12]}[ar] -\end{istgame} -\end{tcblisting} - -\subsection{Signaling games} - -\begin{tcblisting}{listing above text,halign lower=center} -% signaling game: IGT 337.1 (Osborne, 2004b) -\begin{istgame} -\setistgrowdirection'{right} -% game start: choice of chance -\xtdistance{20mm}{20mm} -\istroot(0)[chance node]<180>{Chance} - \istb{H}[l] - \istb{L}[l] - \endist -\istroot(H0)(0-1)<180>{F} - \istb{(p_1,E)}[a] - \endist -\istroot(L0)(0-2)<180>{F} - \istb{(p_1,E)}[a] - \endist -\xtdistance{10mm}{20mm} -% subtree after H is chosen -\istroot(H)(H0-1) - \istb{Buy}[br] - \istb{Refrain}[ar]{-E,0} - \endist -\istcntm(cntm)(H-1)+10mm..20mm+ -\istroot(H1)(cntm)+10mm..8mm+ - \istb{p_2^H}[b] - \istb - \endist -\istroot(CH)(H1-1)<[label distance=-4pt]135>{C} - \istb{Buy}[br]{p_1-E-c_H+p_2^H-c_H, 2H-p_1-p_2^H} - \istb{Refrain}[ar]{p_1-E-c_H, H-p_1} - \endist -% subtree after L is chosen -\istroot(L)(L0-1) - \istb{Buy}[br] - \istb{Refrain}[ar]{-E,0} - \endist -\istcntm(cntm)(L-1)+10mm..20mm+ -\istroot(L1)(cntm)+10mm..8mm+ - \istb - \istb{p_2^L}[a] - \endist -\istroot(CL)(L1-2)<[label distance=-4pt]-135>{C} - \istb{Buy}[br]{p_1-E-c_L+p_2^L-c_L, 2L-p_1-p_2^L} - \istb{Refrain}[ar]{p_1-E-c_L, L-p_1} - \endist -\xtInfoset(H)(L){C}[left] -\xtActionLabel(0)(0-1){\pi}[r] -\xtActionLabel(0)(0-2){1-\pi}[r] -\end{istgame} -\end{tcblisting} - -\mbigskip2 - -\begin{tcblisting}{listing outside text, righthand width=.5\linewidth} -% signaling game -\begin{istgame}[scale=1.3] -\xtdistance{20mm}{20mm} -\istroot(0)[chance node]{$c$} - \istb{\frac12}[a] - \istb{\frac12}[a] - \endist -\xtdistance{10mm}{20mm} -\istroot(1)(0-1)<180>{1} - \istb{a}[l] - \istb{b}[l] - \endist -\istroot(2)(0-2)<0>{1} - \istb{a}[r] - \istb{b}[r] - \endist -\istroot'[north](a1)(1-1) - \istb{L}[bl]{-1,0} - \istb{R}[br]{0,-1} - \endist -\istroot(b1)(1-2) - \istb{L}[al]{2,0} - \istb{R}[ar]{0,2} - \endist -\istroot(a2)(2-2) - \istb{L}[al]{3,0} - \istb{R}[ar]{0,3} - \endist -\istroot'[north](b2)(2-1) - \istb{L}[bl]{1,0} - \istb{R}[br]{0,1} - \endist -\xtInfoset(a1)(b2){2} -\xtInfoset(b1)(a2){2} -\end{istgame} -\end{tcblisting} - - - -%\clearpage -\setsecnumdepth{chapter} -\section{Version history} - -\begin{itemize} -\item v\tmpversion (\tmpdate) This version, to be submitted to CTAN - \begin{itemize} - \item introduced \cmd{\cntmlevdist} and \cmd{\cntmsibdist} - \item introduced \cmd{\cntmdistance} (for internal use) - \item redefined related marcos. - \item package document done - \end{itemize} -\item v0.99g (2017/08/21) - \begin{itemize} - \item redefined the \env{istgame} environment to add \xw{>=stealth} as an option - \item added \xw{text depth=.25ex} as an option to \cmd{\istb} to get better alignment of action labels - \end{itemize} -\item v0.99f (2017/08/02) - \begin{itemize} - \item redefined \cmd{\xtInfosetO(')} - \begin{itemize} - \item added \verb+\begin{scope}[on background layer]...\end{scope}+ - \end{itemize} - \end{itemize} -\item v0.99e (2017/08/01) - \begin{itemize} - \item introduced the prime(\xw{'}) versions to deal with \xw{grow'} (this is the swap version in \tikz) - \item redefined \cmd{\istroot(')} - \item defined \cmd{\istrooto(')} to replace \cmd{\istroot*} - \begin{itemize} - \item \cmd{\istroot*} completely replaced by \cmd{\istrooto} - \end{itemize} - \item redefinde \cmd{\istcntm} - \item defined \cmd{\istcntmarc} - \begin{itemize} - \item \cmd{\istcntm*} completely replaced by \cmd{\istcntmarc} - \end{itemize} - \item redefined \cmd{\xtInfoset(')} and \cmd{\xtInfosetOwner(')} - \item introduced \cmd{\xtInfosetO(')} - \begin{itemize} - \item \cmd{\xtInfoset*} completely replaced by \cmd{\xtInfosetO} - \end{itemize} - \item introduced \cmd{\xtgrowprime} introduced - \item redefined \cmd{\xtNode} accordingly - \end{itemize} -\item v0.99d (2017/07/27) - \begin{itemize} - \item defined \cmd{\xtSubgameBox(*)} and \cmd{\xtSubgameOval(*)} to express a subgame - \end{itemize} -\item v0.99c (2017/07/20) - \begin{itemize} - \item defined \cmd{\xtgrow} to deal with going `clockwise' of branch arrangement - \item defined \cmd{\setistgrowkey} to change between \xw{grow} and \xw{grow'} - \item introduced \cmd{\setistgrowdirection'} by redefining \cmd{\setistgrowdirection} - \item updated `related macros' accordingly - \end{itemize} -\item v0.99b (2017/07/16) - \begin{itemize} - \item renamed \xw{zero node} as \xw{plain node} - \item added \cmd{\setistPlainNodeStyle} - \item defined \cmd{\xtNode*} (for a terminal node text with a plain node) - \item redefined \cmd{\xt<...>NodeStyle} (now all arguments are optional) - \item renamed \cmd{\isthorizontallabelshift} as \cmd{\istactionlabelxshift}, with default \xw{1pt} - \item renamed \cmd{\istverticallabelshift} as \cmd{\istactionlabelyshift}, with default \xw{2pt} - \end{itemize} -\item v0.99a (2017/03/10) - \begin{itemize} - \item started rewriting package manual - \item introduced \cmd{\istb.}\ (for terminal nodes) - \item redefined \cmd{\xtShowTerminalNodes} - \item introduced \cmd{\xtShowEndPoints} and \cmd{\xtHideEndPoints} - \item redefined \cmd{\xtInfoset*}, with \cmd{\xtdefaultinfosep} added - \end{itemize} -\item v0.9 (2017/02/13) - \begin{itemize} - \item some internal macro names changed (\cmd{\xtnode}, \cmd{\xttnode},\cmd{\xtshowtnode}) -% \item conflict with \pkg{tikz-qtree} resolved. (\env{istgame} differs from \env{tikzpicture} with \pkg{tikz-qtree}) -% \item \cmd{\setistbranchanchors} added - \item added \xw{zero node} - \end{itemize} -\item v0.8 (2017/01/17) - \begin{itemize} - \item macro names changed - \begin{itemize} - \item \cmd{\xtdistance}: prefix `\xw{x}' changed to `\xw{xt}' meaning `extensive tree' - \item \cmd{\xtInfoset(*)}, \cmd{\xtInfosetOwner}, \cmd{\xtActionLabel}, \cmd{xtOwner}, \cmd{\xtPayoff}, \cmd{\xtNode} - \item \cmd{\xtShowTerminalNodes}, \cmd{\xtHideTerminalNodes} - \item \cmd{\xtlevdist}, \cmd{\xtsibdist} - \end{itemize} - \item \cmd{\xtNode} redefined - \item some internal macro names changed (including \cmd{\xtpayff}, \cmd{\xtmove}) - \item node styles redefined - \item \cmd{\setistNodeStyle} added for node styles - \item \cmd{\setistdefaultnodecolor}, \cmd{setistdefaultnodebgcolor} added - \end{itemize} -\end{itemize} - - -\section{Acknowledgement} - -The basic idea of the \pkg{istgame} package came from Osborne's \pkg{egameps} package and Chen (2013). A special thanks goes to Kangsoo Kim from KTUG for his great help in using \pkg{expl3} to simplify the appearance and the usage of the macros. - - -\section{References} -\hpara{}Chen, H.~K.~(2013), ``Drawing Game Trees with \tikz,'' \url{http://www.sfu.ca/~haiyunc/notes/Game_Trees_with_TikZ.pdf}. - -\hpara{}Cho, I-S.~(2017), ``\pkg{istgame}: Drawing Game Trees with \tikz,'' in Korean TeX Society, \textit{\TeX, Beyond the World of Typesetting}, Seoul: Kyungmoonsa, 203--237. - -\hpara{}Osborne, M.~J.~(2004a), ``Manual for \pkg{egameps.sty},'' Version 1.1, \url{http://texdoc.net/texmf-dist/doc/latex/egameps/egameps.pdf} - -\hpara{}\uline{\hphantom{Osborne, M.~J}}~(2004b), \textit{An Introduction of Game Theory}, New York: Oxford. - -\hpara{}Tantau, T.~(2015), ``\tikz\ and PGF: Manual for version 3.0.1a,'' \url{http://sourceforge.net/projects/pgf}. - -%\section*{Discussions (in Korean) on KTUG board} -% -%\begin{itemize} -%\item Drawing Game Trees 1: \url{http://www.ktug.org/xe/index.php?document_srl=207287} -% -%\item Drawing Game Trees 1-1: \url{http://www.ktug.org/xe/index.php?document_srl=207513} -% -%\item Drawing Game Trees 1-2: -%\url{http://www.ktug.org/xe/index.php?document_srl=208286} -% -%\item Drawing Game Trees 2: \url{http://www.ktug.org/xe/index.php?document_srl=212043} -% -%\item Drawing Game Trees 2-1: -%\url{http://www.ktug.org/xe/index.php?document_srl=212225} -% -%\item Drawing Game Trees 2-2: -%\url{http://www.ktug.org/xe/index.php?document_srl=212319} -%\end{itemize} diff --git a/Master/texmf-dist/doc/latex/istgame/istgame-doc-v2.0.tex b/Master/texmf-dist/doc/latex/istgame/istgame-doc-v2.0.tex new file mode 100644 index 00000000000..aa91c4d8076 --- /dev/null +++ b/Master/texmf-dist/doc/latex/istgame/istgame-doc-v2.0.tex @@ -0,0 +1,7464 @@ +%!TEX root = istgame-doc.tex + +%\begin{document} +\setcounter{section}{-1} + +\section{Changes and remarks} + +\subsection{Changes} + +Some macros have been \textsc{changed} and \textsc{removed}. +Those who have used these changed and removed macros may want to \textsc{find} and \textsc{replace} the followings: + +%\begin{center} +%\begin{tabu} {X[l1.5]X[l1.5]} \toprule %to .5\linewidth +%\makecell[l]{\textbf{ver. 1.0}} & \makecell[l]{\textbf{ver. 2.0 or later}} \\\midrule +%\cmd{\istb.} & \cmd{\istbt} \\\tabucline- +%\cmd{\xtInfoset'} & \cmd{\xtInfoset} \\\tabucline- +%\cmd{\xtInfosetO'} & \cmd{\xtInfosetO} \\\tabucline- +%\cmd{\setistgrowkey} & \cmd{\setxtgrowkey} \\\tabucline- +%\end{tabu} +%\end{center} + +\begin{center} +\begin{tabular} {lll} \toprule %to .5\linewidth +\makecell[l]{\textbf{ver. 1.0}} & \makecell[l]{\textbf{ver. 2.0 or later}} \\\midrule +\cmd{\istb.} & \cmd{\istbt} \\\cline{1-2} +\cmd{\xtInfoset'} & \cmd{\xtInfoset} \\\cline{1-2} +\cmd{\xtInfosetO'} & \cmd{\xtInfosetO} \\\cline{1-2} +\cmd{\setistgrowkey} & \cmd{\setxtgrowkey} \\\cline{1-2} +\end{tabular} +\end{center} + +\paragraph{Changed and removed macros} + +\begin{itemize}\tightlist + \item The macro name \cmd{\istb.}(terminal version) has been changed + to \cmd{\istbt} (terminal version). + \begin{itemize} + \item This is the opportunity cost of having a new macro \cmd{\istB}. + \end{itemize} +\item The two (unsatisfactory) macros \cmd{\xtInfoset'} and \cmd{\xtInfosetO'} have been removed. + \begin{itemize} + \item The macro \cmd{\xtInfosetO} is completely redesigned, + so that we do not need the macro \cmd{\xtInfosetO'} any more. + \item No reasons could be found to keep (even for the backward compatibility) + the swap versions \cmd{\xtInfoset'} and \cmd{\xtInfosetO'}, + except for the inconvenience to do `find and replace.' + \end{itemize} +\item To keep consistency in naming macros, \cmd{\setistgrowkey} is renamed as \cmd{\setxtgrowkey}. +\end{itemize} + + +\paragraph{Redesigned macros and the environment} + +\begin{itemize}\firmlist +\item \cmd{\xtInfosetO}: completely redefined to improve its function + \begin{itemize} + \item Now a \emph{sloped} information set is possible. + \item It connects two nodes like \cmd{\xtInfosetO(coor1)(coor2)}, + but if the two coordinates are identical it represents a \emph{singleton information set} + by a \emph{circle} by default. + \item This change does not seem to cause much harm, but be aware that + the swap version \cmd{\xtInfosetO'} has been removed and replaced by \cmd{\xtInfosetO}. + \item Be aware also that the way to change the \emph{height} (\xw{1em} by new default) + of an information set has been \emph{changed}, + though you might not see much difference if you have only used the default information sets. + \item With \emph{new macros} \cmd{\xtCInfoset} and \cmd{\xtCInfosetO}, a curved (even skewed curved) information set is now possible. + \end{itemize} +\item \env{istgame} environment: (internal change) + \begin{itemize} + \item Now the each value of the option of \xw{xscale} and \xw{yscale}, if exists, + is extracted and saved at \cmd{\xtxscale} and \cmd{\xtyscale}, respectively. + The value of \xw{scale} is also saved at \cmd{\xtscale} + only when it is used without \xw{xscale} nor \xw{yscale}. + These values are internally used to get the best outputs of trees in many ways. + \item If the \Tikz\ arrow option \xw{->} exists in the option list of an \env{istgame} environment, + you can globally control the arrow-end-shorten value (by default, \xw{shorten >=0pt}) + by using a new macro \cmd{\setistgameshorten}. + This is to get a better result of branches with arrows. + \end{itemize} +\item Some changes that you might not notice have been made, including: + \begin{itemize} + \item The core macros \cmd{\istroot}, \cmd{\istb}, and \cmd{\endist} have literally been redefined + for some purposes, but this makes no difference to users. + \item The options \xw{thin} and \xw{solid} have been added to the definitions of basic node styles. + \item Some default values have been slightly changed. + \end{itemize} +\end{itemize} + +\subsection{What's new} + +\paragraph{Some new functions} + +\begin{itemize}\tightlist +\item \emph{input mode changer} (math or text) for important labels: owners, action labels, and payoffs + \begin{itemize}\tightlist + \item \cmd{\setistmathTF} as the input mode changer for the important labels + \item \cmd{\setistmathTF*} having additional function as the \emph{text font style changer} + \end{itemize} +\item \emph{curved} (even \emph{skewed}) \emph{information sets} + \begin{itemize}\tightlist + \item \cmd{\xtCInfoset} for curved information sets + \item \cmd{\xtCInfosetO} for curved bubble type information sets + \end{itemize} +\item enhanced \emph{continuum of branches} (making \cmd{\istcntm} and \cmd{\istcntmarc} obsolete) + \begin{itemize}\tightlist + \item \cmd{\istrootcntm} for a continuum triangle + \item \cmd{\istrootcntmA} for a continuum arc (with \cmd{\istbA}) + \item \cmd{\cntmAInfoset} and \cmd{\cmtmAInfosetO} for information sets for a continuum of branches + \end{itemize} +\item \emph{arrows} and \emph{middle arrows} on branches + \begin{itemize}\tightlist + \item controllable arrow option \xw{->-} with \cmd{\setxtarrowtips} and middle arrow tip styles + \item \cmd{\xtShowMidArrows} and \cmd{\xtShowArrows} + \end{itemize} +\item and some more + \begin{itemize} + \item \cmd{\istB} for dual action labels + \item \cmd{\xtTimeLineH}, \cmd{\xtTimeLineV}, \cmd{\xtCommentTo}, \cmd{\xtCommentFrom}, etc. + \end{itemize} +\end{itemize} + +\paragraph{List of new macros} +\begin{itemize}\tightlist +\item \cmd{\istbt(*)}: terminal version of \cmd{\istb(*)} + (replacement of the removed macro \cmd{\istb.(*)}) +\item \cmd{\istB(*)}: dual action label version of \cmd{\istb(*)} +\item \cmd{\istBt(*)}: terminal version of \cmd{\istB(*)} +\item \cmd{\istbA(*)}: alternative version of \cmd{\istb(*)} (intended to work with a continuum arc) +\item \cmd{\istbAt(*)}: terminal version of \cmd{\istbA(*)} +% +\listdivider + +\item \cmd{\setistmathTF}: input mode changer (math or text) for owners, action labels, and payoffs +% \begin{itemize}\tightlist +% \item \cmd{\istownermathtrue}, \cmd{\istactionlabelmathtrue}, \cmd{\istpayoffmathtrue}: math mode +% \item \cmd{\istownermathfalse}, \cmd{\istactionlabelmathfalse}, \cmd{\istpayoffmathfalse}: text mode +% \end{itemize} +\item \cmd{\setistmathTF*}: input mode and font style changer for owners, action labels, and payoffs +% \begin{itemize}\tightlist +% \item \cmd{\istownertextfont}, \cmd{\istactionlabeltextfont}, \cmd{\istpayofftextfont} +% \end{itemize} +% +\listdivider + +\item \cmd{\xtCInfoset}: (curved version) curved information set +\item \cmd{\xtCInfosetO}: (curved oval version) curved oval type information set +\item \cmd{\xtCInfosetOTurnX}: turns \xw{X} circles of \cmd{\xtCInfosetO} (to use it just in case) +% +\listdivider + +\item \cmd{\xtInfoset*}: prints owners according to the input mode as set by \cmd{\setistmathTF(*)} +\item \cmd{\xtInfosetO*}: prints owners according to the input mode as set by \cmd{\setistmathTF(*)} +\item \cmd{\xtCInfoset*}: prints owners according to the input mode as set by \cmd{\setistmathTF(*)} +\item \cmd{\xtCInfosetO*}: prints owners according to the input mode as set by \cmd{\setistmathTF(*)} +\item \cmd{\xtOwner*}: prints owners according to the input mode as set by \cmd{\setistmathTF(*)} +\item \cmd{\xtActionLabel*}: prints action labels according to the input mode set by \cmd{\setistmathTF(*)} +\item \cmd{\xtPayoff*}: prints payoffs according to the input mode as set by \cmd{\setistmathTF(*)} +\item \cmd{\xtInfosetOwner*}: prints owners according to the input mode set by \cmd{\setistmathTF(*)} +% +\listdivider + +\item \cmd{\setxtinfosetstyle}: changes line the style (line style, fill, etc.) for all information sets +\item \cmd{\setxtinfosetlayer}: changes the layer of information sets +\item \cmd{\setxtsubgamelayer}: changes the layer of \cmd{\xtSubgameBox} and \cmd{\xtSubgameOval} +\item \cmd{\setistgameshorten}: value of the key \xw{shorten >} in \env{istgame} environment option list +% +\listdivider + +\item \cmd{\cntmdistance}: analogous to \cmd{\xtdistance}, for a continuum of branches +\item \cmd{\cntmdistance*}: incorporates \cmd{\cntmdistance} with \cmd{\xtdistance} +%\item \cmd{\cntmactsibdist}: sibling distance for action branches from \cmd{\istrootcntm} and its variants +\item \cmd{\istrootcntm}: \cmd{\istroot} \xw{+} \xw{cntm}, printing a continuum of branches +\item \cmd{\istrootcntm'}: swap version of \cmd{\istrootcntm} +\item \cmd{\istrootocntm}: (oval version) \cmd{\istrooto} \xw{+} \xw{cntm}, printing a continuum triangle +\item \cmd{\istrootocntm'}: swap version of \cmd{\istrootocntm} +\item \cmd{\cntmpreset}: controls a continuum of branches (line style, color, size, fill color) +\item \cmd{\cntmpreset*}: controls a simple triangle continuum of branches with no background color +\item \cmd{\cntmistb}: similar to \cmd{\istb} for the outermost branches of a continuum triangle +\item \cmd{\cntmistb*}: draws \xw{solid node}s at the ends of the continuum outermost branches +\item \cmd{\istrootcntmA}: \cmd{\istroot} \xw{+} \xw{cntmA}, printing a continuum arc +\item \cmd{\istrootcntmA'}: swap version of \cmd{\istrootcntmA} +\item \cmd{\istrootocntmA}: (oval version) \cmd{\istrooto} \xw{+} \xw{cntmA}, printing a continuum arc +\item \cmd{\istrootocntmA'}: swap version of \cmd{\istrootocntmA} +\item \cmd{\cntmApreset}: controls the features of a continuum arc +\item \cmd{\cntmAlayerpreset}: sets the layer of a continuum wedge (with fill color) +\item \cmd{\cntmAistb}: similar to \cmd{\istb} for the outermost branches of a continuum arc +\item \cmd{\cntmAistb*}: draws \xw{solid node}s at the ends of the continuum arc outermost branches +\item \cmd{\cntmAInfoset}: prints an information set for a continuum arc +\item \cmd{\cntmAInfosetO}: oval version of \cmd{\cntmAInfoset} +\item \cmd{\xtShowEndPoints*}: shows additionally the outermost endpoints of a continuum of branches +\item \cmd{\xtHideEnpPoints*}: turns off only the endpoints of a continuum of branches +\item \cmd{\cntmAexpostShowEndPoints}: shows the two endpoints of a continuum arc +% +\listdivider + +\item \cmd{\setxtarrowtips}: works through \xw{->-} to control the features of middle arrow tips +\item \cmd{\xtShowMidArrows}: shows arrows in the middle of branches +\item \cmd{\xtHideMidArrows}: hides middle arrows drawn by \cmd{\xtShowMidArrows} +\item \cmd{\setxtshowmidarrows}: controls the middle arrows on branches in a simple tree +\item \cmd{\xtShowArrows}: shows arrows at the ends of branches with endpoints +\item \cmd{\xtHideArrows}: hides arrows drawn by \cmd{\xtShowArrows} +\item \cmd{\xtHideArrows*}: hides arrows but with endpoints remained +\item \cmd{\setxtshowarrows}: controls the features of the arrows shown by \cmd{\xtShowArrows} +% +\listdivider + +\item \cmd{\xtTimeLineH}: a horizontal time-line +\item \cmd{\xtTimeLineH'}: a horizontal time-line with a label at the other end +\item \cmd{\xtTimeLineV}: a vertical time-line +\item \cmd{\xtTimeLineV'}: a vertical time-line with a label at the other end +\item \cmd{\xtCommentTo}: to leave a comment \xw{to} a node \xw{from} a \emph{relative} coordinate +\item \cmd{\xtCommentFrom}: to leave a comment \xw{from} an \emph{absolute} coordinate \xw{to} a node +% +\listdivider + +\item \cmd{\xtcureslopedlabelsNS}: cures the \TikZ\ issue of sloped labels with asymmetric scales +\item \cmd{\xtcureslopedlabelsEW}: same, for a tree growing eastwards or westwards\par + The last two macros are for only temporary use and could be removed at any time. +\end{itemize} + + +\paragraph{List of new arrow styles} + +\begin{itemize}\tightlist +\item \xw{->-}: (controllable) middle arrow tip, taking one optional argument +\item \xw{->>-}: double middle arrow tip +\item \xw{->>>-}: triple middle arrow tip +\item \xw{-o-}: circle middle arrow tip +\item \xw{-x-}: cross middle arrow tip +\end{itemize} + +\subsection{How to read this document} + +%First of all, since this package is just an application of \Tikz\ to draw game trees, not for learning \Tikz, you should have basic knowledge of using \Tikz\ to take a full advantage of this package. + +As a \Tikz\ user, if this is your first read of this manual, \emph{all you need to read} is Section~\ref{sec:gettingstarted} entitled ``\emph{Getting started}." +That's only \emph{four} pages long. (You can find a little secret at the first part of Section~\ref{sec:desperateusers} entitled ``\emph{Complete examples for desperate users}.") +Every example in this document is provided with its complete codes you can copy to use. +Now you can go to Section~\ref{sec:gettingstarted} to get started! + +If you are not urgent, you can continue to read sections on \emph{core macros} up to Section~\ref{sec:istb}. That's about \emph{twenty} pages total. Still more time? Then read Section~\ref{sec:corelabels} (entitiled ``\emph{Important labels: players, action labels, and payoffs}") and Section~\ref{sec:setistmathTF} (entitled ``\emph{Input mode and text font style changer}"). +That's about \emph{thirty} pages all total. + +Throughout the manual, just disregard the parts with marks including ``\emph{fine-tuning}" or ``\emph{not for most users}," if you are not an experienced user of this package. Just reading first part of each section will suffice most users to draw game trees in almost all cases, hopefully. + +If you you are an experienced user of the \pkg{istgame} package, enjoy every detail of the package. + +%\clearpage +\subsection{Remarks} + +\paragraph{Rules of thumb for the usage of delimiters} + +Though the rules are not strictly observed, it might be useful to go over the rules of thumb for the usage of delimiters. + +\begin{itemize}\tightlist +\item \verb+{ }+: contents, texts, important dimensions (mandatory or optional) +\item \xw{[ ]}: usual options, positions or directions, node types, fill color +\item \xw{( )}: coordinate related arguments, dimension as the last optional argument, special purposes +\item \xw{< >}: angles (or directions), special purposes (mostly used right before \verb+{ }+) +\item \xw{+ .. +}: only for the local change of level and sibling distances with \cmd{\istroot} and its friends +\item \xw{! !}: \xw{midpoint factor} only for curved information sets +\end{itemize} + +As for the order of delimiters, the (somewhat loose) rules are as follows: + +\begin{itemize}\tightlist +\item Generally, all macros are designed to avoid leaving an empty argument like \xw{[][blue]}, as possible as they can do. (This is \emph{input minimalism} for lazy users including myself!) +\item \xw{< >} is used just before \verb+{ }+, except for \xw{\istb} and its friends. +\item \xw{( )} as the last optional argument is for dimensions, like \xw{(1em)} or \xw{(3pt)}. +\item The order mostly looks like \xw{<>\{\}[]} or \xw{<>\{\}[]()}, especially after a mandatory argument. +\end{itemize} + +\paragraph{Optional versions of macros} + +Some macros have a starred(\xw{*}) version or a swap(\xw{'}) version, for example, \cmd{\istb*} or \cmd{\istroot'}. + +\begin{itemize}\tightlist +\item \xw{* version}: just another version with different functions (in some cases, it's quite different) +\item \xw{' version}: clockwise arrangement of branches or its related version +\end{itemize} + + +\paragraph{Global macros} + +Some macros have global effects, so you can use them outside of the \env{istgame} environment or even in the preamble of your document, but \emph{with very great caution}. + +The following macros, all prefixed by \cmd{\setist...}, can be used outside of the \env{istgame} environment, to change the default values of the options: + +\begin{itemize}\tightlist +\item \icmd{\setistgamefontsize}\verb+{}+ \hfill (default: \cmd{\normalsize}) +\item \icmd{\setistgameshorten}\verb+{}+ \hfill (default: \xw{0pt}) + \begin{itemize} + \item This works only when \xw{->} exists in the option list of the \env{istgame} environment. + \end{itemize} +\end{itemize} + +Though it is not recommended, you can use all the macros prefixed by \cmd{\setist...} inside or outside of the \env{istgame} environment to change the default values. + +\begin{itemize}\tightlist +\item \icmd{\setistmathTF}, \icmd{\setistmathTF*} \hfill (initially: \xw{011}) +\item \icmd{\setistdefaultnodeinnersep} \hfill (default: \xw{1pt}) +\item \icmd{\setistdefaultnodeoutersep} \hfill (default: \xw{0pt}) +\item \icmd{\setistdefaultnodedrawcolor} \hfill (default: \xw{black}) +\item \icmd{\setistdefaultnodefillcolor} \hfill (default: \xw{white}) +\item \icmd{\setist<...>NodeStyle} +\item \icmd{\setistgrowdirection}, \icmd{\setistgrowdirection'} \hfill (default: \xw{south}): + \begin{itemize} + \item You may not want to use (but still can use) this outside of an \env{istgame} environment. + \end{itemize} +\end{itemize} + +You can even do, in the preamble of your document, like: + +\begin{verbatim} + \usepackage{istgame} + \setistgamefontsize{\normalsize} + \setistdefaultnodedrawcolor{black} + \setistSolidNodeStyle{2.4pt} + \setistgameshorten{.3pt} + \setistmathTF011 +\end{verbatim} + +The node styles such as \xw{ellipse node} and \xw{rectangle node} has \xw{white} as the default background color. +This means that if the paper color of your document is not white, say, \xw{blue!16}, you might not satisfy the results because the nodes have \xw{white} background. +In this case you can resolve the conflict by adding the following two lines at the very first of your document: +\begin{verbatim} + \papercolor{blue!16} + \setistdefaultnodefillcolor{blue!16} +\end{verbatim} + +The background color of the TeXShop preview in the dark mode of \xw{macOS} \xw{Mojave} is very similar to \xw{black!16}. + + +\paragraph{Known problem with the \pkg{tikz-qtree} package} + +It seems that +\pkg{tikz-qtree} changes node anchors. +So, with the \pkg{tikz-qtree} package uploaded, you will get unexpected results +when you draw a game tree by using the \xw{tree} library in \TikZ. +Since \pkg{istgame} is based on the \xw{tree} library, it is also affected by \pkg{tikz-qtree}, resulting in unexpected outputs. + +The best way to resolve this problem is that you DO NOT LOAD \pkg{tikz-qtree} when you draw game trees with \TikZ. +If, for some reason, you need to load \pkg{tikz-qtree} when you draw a game tree by using the \pkg{istgame} package, a temporary solution to resolve the conflict is to add the \TikZ\ option \xw{edge from parent path} in the option list of \pkg{istgame} environment as follows: + +\xbigskip1 +\begin{tcblisting}{listing only} + % tikz-qtree conflict resolution (only with \usepackage{tikz-qtree}) + [ + edge from parent path={(\tikzparentnode) -- (\tikzchildnode)} + ] +\end{tcblisting} +%\begin{tcblisting}{listing only} +%\begin{istgame}% +% [ % tikz-qtree conflict resolution (only with \usepackage{tikz-qtree}) +% edge from parent path={(\tikzparentnode) -- (\tikzchildnode)} +% ] +% < istgame codes > +%\end{istgame} +%\end{tcblisting} +%\xbigskip1 + +%\tmpclearpage +\subsection{Previous changes (up to version 1.0)} + +A considerable number of macro names have been changed in the version 0.8 (Jan.\@ 17, 2017) of this package.\footnote{The \pkg{istgame} package of the version older than ver.\@ 1.0 had been distributed via the KTUG (Korean TeX Users Group) Private Repository.} +The following old macro names in any previously written documents using codes in \pkg{istgame} ver.\@ 0.7 or before, should be replaced by the new names, accordingly. + +Also, \cmd{\istroot*}, \cmd{\istcntm*}, and \cmd{\xtInfoset*} should be replaced by \cmd{\istrooto}, \cmd{\istcntmarc}, and \cmd{\xtInfoseto}, respectively, in the version 1.0 or later. + +%\begin{center} +%\begin{tabu} {X[l4]X[l3]X[l2]} \toprule % to\linewidth +%\makecell[l]{\textbf{ver.\@ 0.7 or before}} & \makecell[l]{\textbf{ver.\@ 0.8 or later}} & \makecell[l]{\textbf{ver.\@ 1.0 or later}}\\\midrule +%\cmd{\xdistance} & \cmd{\xtdistance} & \\\tabucline- +%\cmd{\xDot} &\cmd{\xtNode} & \\\tabucline- +%\cmd{\xInfoset} &\cmd{\xtInfoset} & \\\tabucline- +%\cmd{\xInfoset*} &\cmd{\xtInfoset*} & \cmd{\xtInfosetO} \\\tabucline- +%\cmd{\xInfosetOwner} &\cmd{\xtInfosetOwner} & \\\tabucline- +%\cmd{\xActionLabel} &\cmd{\xtActionLabel} & \\\tabucline- +%\cmd{\xPayoff} &\cmd{\xtPayoff} & \\\tabucline- +%\cmd{\ShowTerminalNodes} &\cmd{\xtShowTerminalNodes} & \\\tabucline- +%\cmd{\HideTerminalNodes} &\cmd{\xtHideTerminalNodes} & \\\tabucline- +%\cmd{\levdist} &\cmd{\xtlevdist} & \\\tabucline- +%\cmd{\sibdist} &\cmd{\xtsibdist} & \\\tabucline- +%\cmd{\setistactionlabelshift} & ~ & \cmd{\xtALPush} \\\tabucline- +%\cmd{\setistactionlabelposition} & ~ & \cmd{\xtALShift} \\\tabucline- +%\cmd{\istroot*} & & \cmd{\istrooto} \\\tabucline- +%\cmd{\istcntm*} & & \cmd{\istcntmarc} \\\tabucline- +%\end{tabu} +%\end{center} + +\begin{center} +\begin{tabular} {lll} \toprule % to\linewidth +\makecell[l]{\textbf{ver.\@ 0.7 or before}} & \makecell[l]{\textbf{ver.\@ 0.8 or later}} & \makecell[l]{\textbf{ver.\@ 1.0 or later}}\\\midrule +\cmd{\xdistance} & \cmd{\xtdistance} & \\\cline{1-3} +\cmd{\xDot} &\cmd{\xtNode} & \\\cline{1-3} +\cmd{\xInfoset} &\cmd{\xtInfoset} & \\\cline{1-3} +\cmd{\xInfoset*} &\cmd{\xtInfoset*} & \cmd{\xtInfosetO} \\\cline{1-3} +\cmd{\xInfosetOwner} &\cmd{\xtInfosetOwner} & \\\cline{1-3} +\cmd{\xActionLabel} &\cmd{\xtActionLabel} & \\\cline{1-3} +\cmd{\xPayoff} &\cmd{\xtPayoff} & \\\cline{1-3} +\cmd{\ShowTerminalNodes} &\cmd{\xtShowTerminalNodes} & \\\cline{1-3} +\cmd{\HideTerminalNodes} &\cmd{\xtHideTerminalNodes} & \\\cline{1-3} +\cmd{\levdist} &\cmd{\xtlevdist} & \\\cline{1-3} +\cmd{\sibdist} &\cmd{\xtsibdist} & \\\cline{1-3} +\cmd{\setistactionlabelshift} & ~ & \cmd{\xtALPush} \\\cline{1-3} +\cmd{\setistactionlabelposition} & ~ & \cmd{\xtALShift} \\\cline{1-3} +\cmd{\istroot*} & & \cmd{\istrooto} \\\cline{1-3} +\cmd{\istcntm*} & & \cmd{\istcntmarc} \\\cline{1-3} +\end{tabular} +\end{center} + + +%\clearpage + +\section{Getting started} +\label{sec:gettingstarted} + +The package \ipkg{istgame} provides macros built on \TikZ\ to draw game trees. The core macros provided with this package are \icmd{\istroot}, \icmd{\istb}, and \icmd{\endist}. +\cmd{\istroot} pins down the root of a tree or a subtree, \cmd{\istb} represents a branch, and \cmd{\endist} indicates the end of drawing a simple tree. Without \cmd{\endist}, the tree is NOT actually drawn, with no error messages produced. +A tree drawn by the sequence of \cmd{\istroot-}\cmd{\istb-}\cmd{\endist} is a \ixsw{simple tree}. +You can draw a whole game tree by repeatedly connecting these \emph{simple tree structures}. + +\xbigskip1 + +Here, the prefix `ist' stands for `it's a simple tree.' You can also read it as `insung's simple tree' if you would like. + +\xbigskip1 + +The package \pkg{istgame} depends on the packages \ipkg{tikz}, \ipkg{xparse}, and \ipkg{expl3}. + +To use the \pkg{istgame} package you must load the package in the preamble of your document: +\begin{verbatim} + \usepackage{istgame} +\end{verbatim} +The package uses the following \TikZ\ libraries: +\begin{verbatim} + trees,calc,arrows,shapes,positioning,backgrounds,fit,decorations.markings, +\end{verbatim} +and also loads \xw{patterns} and \xw{intersections} for additional use. + + +\subsection{Getting-started example: a simple tree} + +Let us get started with a simple self-explanatory example: + +\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} +%% \usepackage{istgame} +% Example: a simple tree +\begin{istgame} +\istroot(0)(0,0) % names the root as (0) at (0,0) + \istb % endpoint will be (0-1), automatically + \istb % endpoint will be (0-2), automatically + \istb % endpoint will be (0-3), automatically + \endist % end of simple (parent-child) structure +\end{istgame} +\end{tcblisting} + +The resulting tree has the \emph{height} of \xw{15mm} and +the \emph{distance between two neighbor endpoints} (not shown) is also \xw{15mm} by default. +In \TikZ, the height is called the \ixw{level distance} and +the distance between two neighbor endpoints is called the \ixw{sibling distance}. + +If the second parenthesis argument of \cmd{\istroot} is omitted, it is regarded as \xw{(0,0)} by default, +otherwise it is necessary to specify the coordinate from which a simple tree starts. + +\subsection{Connecting simple tree structures} + +Basically, in order to draw a whole game tree, we just repeat the simple \verb|\istroot-\istb-\endist| structure. + +\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} +% Example: connecting simple trees +\begin{istgame} +\istroot(0) % names the root (0) at (0,0) + \istb % endpoint will be (0-1), automatically + \istb % endpoint will be (0-2) + \istb % endpoint will be (0-3) + \endist % end of simple (parent-child) structure +\istroot(c)(0-3) % names the subroot (c) at (0-3) + \istb % endpoint will be (c-1) + \istb % endpoint will be (c-2) + \endist +\end{istgame} +\end{tcblisting} + +In the above example, the simple \emph{subtree} is rooted at \xw{(0-3)}, names the subroot \xw{(c)}, and has two branches whose endpoints are automatically named \xw{(c-1)} and \xw{(c-2)}, respectively. + +Note that the user-defined names of the (sub)roots and the names of endpoints are arranged \xw{counterclockwise} (from left to right) by \TikZ\ at the endpoints of branches, which can be used as coordinates in the usual \TikZ\ way. + +\subsection{Complete examples for desperate users} +\label{sec:desperateusers} + +Basically, \cmd{\istroot} designates a \emph{decision node} and its \emph{owner} (or a \emph{player}), +\cmd{\istb} prints a \emph{branch} coming out from the decision node with \emph{action labels} and \emph{payoffs}, and \cmd{\endist} actually draws the tree structures. (One secret is that I almost always use only the basic features of the \pkg{istgame} package, discussed in this subsection.) + +\subsubsection{How to put a decision node and its owner} + +\begin{tcblisting}{listing only} +\istroot()(){} +\end{tcblisting} + +The only \emph{mandatory} argument of \icmd{\istroot} is \xw{()} and all others are \emph{optional}. +If the \xw{()} where the \emph{\isw{root}} or a \emph{decision node} is placed is omitted, it is regarded as \xw{(0,0)} by default. +The position of an \isw{owner} (or a \isw{player}) is \xw{} (or equivalently, \xw{<90>} degree) by default. +The \emph{owner} of a node is printed in \emph{text mode} by default. + +%\xbigskip1 +\begin{tcblisting}{listing outside text, righthand width=.3\linewidth,breakable} +% Example: first try +\begin{istgame} +\xtdistance{15mm}{30mm} +\istroot(0)(0,0){Child} + \istb%{Good}[above left]{(0,2)} + \istb%{Bad}[above right] + \endist +\istroot(1)(0-2)<30>{Parent} + \istb%{Forgive}[above left]{(1,1)} + \istb%{Punish}[above right]{(-1,-1)} + \endist +\end{istgame} +\end{tcblisting} + +In fact, \cmd{\istroot} and its variants have much more functions than these. Later, you can look into Section~\ref{sec:istroot} on page~\pageref{sec:istroot} for more details. + +\subsubsection{How to print branches with action labels and payoffs} + +\begin{tcblisting}{listing only} +\istb{}[]{}[] +\end{tcblisting} + +With the macro \icmd{\istb}, you can draw a \emph{\isw{branch}} and put an \emph{\isw{action}} label and \emph{\isw{payoff}}s as optional arguments. + +%\xbigskip1 +\begin{tcblisting}{listing outside text, righthand width=.3\linewidth,breakable} +% Example: first try +\begin{istgame} +\xtdistance{15mm}{30mm} +\istroot(0){Child} + \istb{Good}[above left]{(0,2)} + \istb{Bad}[above right] + \endist +\istroot(1)(0-2)<30>{Parent} + \istb{Forgive}[al]{(1,1)} + \istb{Punish}[ar]{(-1,-1)} + \endist +\end{istgame} +\end{tcblisting} + +The positions of an action label and payoffs are specified as options right after each of the two. +When you omit the position of payoffs, the package prints them naturally, but still you can change the location using an option like \xw{[left]} or \xw{[above left]}. For the positions of action labels and payoffs, you can use an abbreviation \xw{[al]} for \xw{[above left]} and similarly \xw{[ar]}, \xw{[bl]}, and \xw{[br]}. +The abbreviations \xw{[a]}, \xw{[b]}, \xw{[l]}, and \xw{[r]} are also available. + +Both of the \emph{action labels} and \emph{payoffs} are printed in \emph{math mode} by defualt. (You can change the input mode for owners, action labels, and payoffs using a very useful macro \cmd{\setistmathTF}, documented in Section~\ref{sec:setistmathTF} on page~\pageref{sec:setistmathTF}.) + +In fact, \cmd{\istb} and its variants have much more functions than these. For more details, see Section~\ref{sec:istb}, on page~\pageref{sec:istb}. If this is your first read of this manual, however, you don't need to bother about all the details at the moment. + +Following three sections are about an information set, a continuum of branches, and changing the direction of tree growing. If you do not need to use them now, the core macros \cmd{\istroot}, \cmd{\istb}, and \cmd{\endist} are \emph{all you need to know about} drawing game trees of any size, small or big. +Just connect simple trees to complete a whole tree. + +\subsubsection{How to put information sets} + +The macro \icmd{\xtInfoset} connects two nodes with a densely dotted line, by default, representing an information set. + +\xbigskip1 +\begin{tcblisting}{listing only} +\xtInfoset()(){}[] +\end{tcblisting} + + +The two node coordinates are \emph{mandatory}. +You can put the owner of an information set as an optional argument. An owner is printed above (by default) the line in \emph{text mode}, which can be changed. +For more details about \cmd{\xtInfoset}, see Section~\ref{sec:infoset} on page~\pageref{sec:infoset}. + +%\xbigskip1 +In the example below, the macro \cmd{\xtInfoset} is used to show an \isw{information set}. + +\xbigskip1 +\begin{tcblisting}{listing outside text, righthand width=.35\linewidth} +% Example: information set +\begin{istgame} +%\setistgrowdirection'{east} +\xtdistance{15mm}{30mm} +\istroot(0){Alice} + \istb{A}[al]{(2,2)} + \istb{D}[ar] + \endist +\istroot(1)(0-2){Alice} + \istb{L}[al] + \istb{R}[ar] + \endist +\xtdistance{10mm}{20mm} +\istroot(2)(1-1) + \istb{\ell}[al]{(4,2)} + \istb{r}[ar]{(1,1)} + \endist +\istroot(3)(1-2) + \istb{\ell}[al]{(3,2)} + \istb{r}[ar]{(0,3)} + \endist +\xtInfoset(2)(3){Elaine} +\end{istgame} +\end{tcblisting} +\xsmallskip1 + +The package also provides the macro \cmd{\xtInfosetO} to draw a bubble type information set. +Just replace \cmd{\xtInfoset} with \cmd{\xtInfosetO} (see Section~\ref{ssec:xtInfosetO} on page~\pageref{ssec:xtInfosetO}). + +You can also draw a curved information by using \cmd{\xtCInfoset} (Section~\ref{ssec:xtCInfoset}) and even a curved bubble type by using \cmd{\xtCInfosetO} (Section~\ref{ssec:xtCInfosetO}). You can try now. + + +\subsubsection{How to put a continuum of branches} + +Just use \cmd{\istrootcntm} (\cmd{\istroot\ + cntm}), instead of \cmd{\istroot}, to draw a \isw{continuum} of branches. + +\xbigskip1 +\begin{tcblisting}{listing only} +\istrootcntm()(){} +\end{tcblisting} + +The macro \icmd{\istrootcntm} works just like \cmd{\istroot}, but it prints a background triangle in \xw{black!25}, by default, representing a continuum of branches. + +\xbigskip1 +\begin{tcblisting}{listing outside text, righthand width=.35\linewidth} +% Example: continuum of branches +\begin{istgame}[font=\scriptsize] +\istrootcntm(0){1} + \istb{x}[r] \istbm \endist +\xtdistance{10mm}{20mm} +\istroot(1)(0-1)<120>{2} + \istb{Y}[al]{x,1-x} \istb{N}[ar]{0,0} \endist +\end{istgame} +\end{tcblisting} +\xsmallskip1 + +Here, \cmd{\istbm} represents a missing (or an invisible) branch (see page~\pageref{page:istbm}). + +%\xbigskip1 +You can also change the color and size of the triangle representing a continuum of branches. +For more details on \cmd{\istrootcntm} see Section~\ref{ssec:istrootcntm}, on page~\pageref{ssec:istrootcntm}. + +The package also provides the macro \cmd{\istrootcntmA} to draw an arc to represent a continuum of branches. +You can just replace \cmd{\istrootcntm} by \cmd{\istrootcntmA} to do that, but let us not try this now. +(If you really want to try this now, you should change the first \cmd{\istb} to \cmd{\istbA} and then take out \cmd{\istbm} in the above example. It is said not to try this now.) +For more details on \cmd{\istrootcntmA} see Section~\ref{ssec:istrootcntmA}, on page~\pageref{ssec:istrootcntmA}. + +You can use every options and macros you can use for the \env{tikzpicture} environment with the \env{istgame} environment. In the above example, \verb+font=\scriptsize+ is used as an option. + +\subsubsection{How to change the growing direction of a tree} + +With \cmd{\setistgrowdirection} or \cmd{\setistgrowdirection'}, you can easily change the \isw{direction} (\xw{south} by default) to which a game tree grows, as shown in the example below. + +%\xbigskip1 +\begin{tcblisting}{listing outside text, righthand width=.35\linewidth} +% Example: \setistgrowdirection(') +\begin{istgame}[scale=1.2] +\setistgrowdirection'{east} +\istroot(0)<180>{1} + \istb{a}[al] + \istb{b}[a] + \istb{c}[bl] + \endist +\xtdistance{10mm}{20mm} +\istroot(1)(0-2)<135>{2} + \istb{Y}[al]{x,1-x} + \istb{N}[bl]{0,0} + \endist +\end{istgame} +\end{tcblisting} +\xbigskip1 + +All you need to do is just to specify the direction you want, like \cmd{\setistgrowdirection\{west\}}, \cmd{\setistgrowdirection'\{east\}}, or \cmd{\setistgrowdirection'\{-45\}}. The prime version (\xw{'}) is just to arrange branches \xw{clockwise} (by default \xw{coutnerclockwise}). In the above example, if you use \cmd{\setistgrowdirection} without the prime, the branches will be arranged \xw{counterclockwise}, like $a$, $b$, and $c$ \emph{from bottom to top}. +When changing the direction of a tree, you may want to relocate the owner and action labels. +For more details, see Sections~\ref{sec:growing} (on page~\pageref{sec:growing}) and~\ref{sec:payoffdirection} (on page~\pageref{sec:payoffdirection}). + +Now you are ready to draw any standard game trees such as all game trees in Osborne's book. + + +\section{Important distances: \protect\cmd{\xtdistance}} + +\label{sec:xtdistance} + +The length and direction of branches in a simple tree can be controlled by the macro \icmd{\xtdistance}. +Here, the prefix \xw{xt} stands for \ixsw{extensive tree}. + +\xbigskip1 +\begin{tcblisting}{listing only} +% syntax: \xtdistance + \xtdistance[]{}{} +% defaults: + [1]{15mm}{15mm} +\end{tcblisting} +\xbigskip1 + +The macro \cmd{\xtdistance} sets or resets the \xw{level distance} and the \xw{sibling distance}, respectively. +Note also that internally, for example, \cmd{\xtdistance\{20mm\}\{30mm\}} assigns \xw{20mm} to \icmd{\xtlevdist} and \xw{30mm} to \icmd{\xtsibdist}, which renew the default distances. +It is effective until you change the distances by using another \cmd{\xtdistance}. + +\begin{center} +\begin{istgame}[scale=2] +\istroot(0) +\istb* \istb* \istb* \endist +\coordinate (A) at ([xshift=-10pt]0-|0-1) ; +\coordinate (B) at ([xshift=-10pt]0-1) ; +\coordinate (C) at ([yshift=-10pt]0-1) ; +\coordinate (D) at ([yshift=-10pt]0-2) ; +\begin{scope}[blue] +\draw [|<->|] (A) -- (B) ; +\draw [|<->|] (C) -- (D) ; +\node at ($(A)!.5!(B)$) [left] {\makecell[c]{level distance\\\xw{\xtlevdist}}} ; +\node at ($(C)!.5!(D)$) [below] {\makecell[c]{sibling distance\\\xw{\xtsibdist}}} ; +\end{scope} +\end{istgame} +\end{center} + +You can use \cmd{\xtdistance} at any time you want to change the length and the directions of branches. +Since we are dealing with simple \emph{parent-child} tree structures, \xw{} is \xw{1} by default. +(The level depth number other than \xw{1} is not expected to be used.) + +\xbigskip1 +\begin{tcblisting}{listing outside text, righthand width=.3\linewidth} +% Example: \xtdistance +\begin{istgame} +\xtdistance{15mm} % default +\istroot(0) % names the root (0) at (0,0) + \istb % endpoint will be (0-1), automatically + \istb % endpoint will be (0-2) + \istb % endpoint will be (0-3) + \endist % end of simple (parent-child) structure +\xtdistance{15mm}{30mm} % changes sibling dist +\istroot(a)(0-1) % names the subroot (a) at (0-1) + \istb % endpoint will be (a-1) + \istb % endpoint will be (a-2) + \endist +\end{istgame} +\end{tcblisting} +\xbigskip1 + + +%\xbigskip1 +\remark + +\begin{itemize} +\item Since \cmd{\xtlevdist} and \cmd{\xtsibdist} are assigned values by \cmd{\xtdistance}, you can use +these values to do some calculation, for example, like \verb+1.2*\xtlevdis+ or \verb+1.5*\xtsibdist+. +\item The starred version \icmd{\cntmdistance*} is provided to deal with a continuum of branches and \cmd{\xtdistances} together, which is not documented at the moment. +See Section~\ref{sec:xtdistance*}, on page~\pageref{sec:xtdistance*}, +for more details about \cmd{\cntmdistance*}. +\end{itemize} +%\xbigskip1 + +In fact, the core macros are much more powerful. \cmd{\istroot} controls the direction to which a simple parent-child tree grows, +node styles, the node owner and its position, the height and sibling distance of a current simple tree, etc. +\cmd{\istb} specifies the growing direction of an individual branch, branch line styles, branch color, action labels, and payoffs and their position. +Below we will see in more details on how the core macros and others work. + + +\section{The \env{istgame} environment and node styles} + +\subsection{The \env{istgame} environment} + +\label{ssec:envistgame} + +The package provides the \ienv{istgame} environment, which is basically the sum of the \ienv{tikzpicture} environment plus some additional functions and different initial values. +So it accepts all the options and macros that can be used for the \env{tikzpicture} environment. (Note that most of the macros provided by the package work also in the \env{tikzpicture} environment, but some works only in the \env{istgame} environment.) + +\xbigskip1 +\begin{tcblisting}{listing only} +% istgame environment +% \def\istgame@default@fontsize{\normalsize} +\begin{istgame}[ ] + < istgame contents > + < tikzpicture contents > +\end{istgame} +% default options: +[ font=\normalsize , >=stealth ] +\end{tcblisting} + +The default font size is set as \verb|font=\normalsize|. +You can globally change the default font size by using \icmd{\setistgamefontsize}, like +\verb|\setistgamefontsize{\scriptsize}|. +Since the environment \env{istgame} is basically the same as \env{tikzpicture}, you can also locally change the font size by using the \xw{font} option key, like +\verb|\begin{istgame}[font=\scriptsize]...\end{istgame}|. + +\xbigskip1 +\remark \textbf{(Not for most users)} What the \env{istgame} environment \emph{internally} does includes: +% more than \env{tikzpicture}: + +\begin{itemize} +\item +In the newly designed \env{istgame} environment, it internally checks and extracts the optional values of \xw{xscale} and \xw{yscale} and, if exist, saves the values (\xw{1.0} by default) at \icmd{\xtxscale} and \icmd{\xtyscale}, respectively. +And If the optional value of \xw{scale} exists, it is saved at \icmd{\xtscale} only when neither \xw{xscale} nor \xw{yscale} exists. +You can use these values to calculate something you want, like \verb|5*1/\xtscale|. +The extracted values are internally used to get the best results of the shapes of bubble type information sets. +\item +The \env{istgame} environment also checks if the arrow option \xw{[->]} exists in the option list for the environment. If it exists the \env{istgame} adds \xw{shorten >=} (by default \xw{0pt}) to the list as the first option together with \xw{[->]}. +You can change the default value, +like \cmd{\setistgameshorten\{1.3pt\}}. (Though this is \emph{not for most users}, you can see some more details, in Section~\ref{sec:setistgamearrowendshorten}.) +\end{itemize} + +%\tmpclearpage + +\subsection{Node styles} +\label{sec:nodestyles} + +\subsubsection{Basic node styles} + +The \xw{tikzstyle}'s of the six basic node styles are predefined. + +\begin{itemize}\tightlist +\item \ixw{plain node}: draws nothing + \hfill (default: \xw{inner sep=1pt}) +\item \ixw{null node}: \begin{istgame}\istroot(0)[null node]\endist\end{istgame} (very small node) + \hfill (default: \xw{minimum size=0.2pt}) +\item \ixw{solid node}: \begin{istgame}\istroot(0)[solid node]\endist\end{istgame} (default node style) + \hfill (default: \xw{minimum size=2.4pt}) +\item \ixw{hollow node}: \begin{istgame}\istroot(0)[hollow node]\endist\end{istgame} + \hfill (default: \xw{minimum size=2.8pt}) +\item \ixw{rectangle node}: \begin{istgame}\istroot(0)[rectangle node]\endist\end{istgame} + \hfill (defaults: \xw{inner sep=2pt}, \xw{minimum size=4pt}) +\item \ixw{ellipse node}: \begin{istgame}\istroot(0)[ellipse node]\endist\end{istgame} + \hfill (defaults: \xw{inner sep=1.5pt}, \xw{minimum size=4.8pt}) +\end{itemize} + + +For some special cases, you may want to change some node styles, including the minimum size. This can be done by \icmd{\setist<...>NodeStyle}, all of whose arguments are optional. + +\begin{verbatim} +syntax: + \setistPlainNodeStyle{}{} + \setistNullNodeStyle[]{}[][] + \setistSolidNodeStyle[]{}[][] + \setistHollowNodeStyle[]{}[][] + \setistRectangleNodeStyle[]{}[][] + \setistEllipseNodeStyle[]{}[][] +\end{verbatim} + + +\begin{tcblisting}{listing outside text, righthand width=.1\linewidth} +% Examples: +\begin{istgame}\setistSolidNodeStyle[blue]{10pt} + \istroot(0)[solid node]\endist\end{istgame}\\[1ex] +\begin{istgame}\setistHollowNodeStyle[blue]{10pt}[yellow] + \istroot(0)[hollow node]\endist\end{istgame}\\[1ex] +\begin{istgame}\setistRectangleNodeStyle{10pt}[red][.5] + \istroot(0)[rectangle node]\endist\end{istgame}\\[1ex] +\begin{istgame}\setistEllipseNodeStyle[blue]{10pt}[green] + \istroot(0)[ellipse node]\endist\end{istgame}\\[1ex] +\begin{istgame}\setistNullNodeStyle[blue!20]{10pt} + \istroot(0)[null node]\endist\end{istgame} +\end{tcblisting} + +\xbigskip1 + +These basic node styles have their aliases, for convenience, for those who are familiar with game theoretic terminology. + +\begin{tcblisting}{listing only,breakable} +% aliases for game theorists +\tikzset{decision node/.style=solid node} % decision nodes +\tikzset{terminal node/.style=solid node} % terminal nodes +\tikzset{initial node/.style=hollow node} +\tikzset{chance node/.style=hollow node} +\end{tcblisting} + +The set of all nodes of a game tree can be partitioned into +the set of \ixw{decision nodes} and that of \ixw{terminal nodes}. +You can use \ixw{initial node} +to distinguish the \ixsw{root} (or the \xw{initial node}) of a game tree from decision nodes. +You can also use \ixw{chance node} to represent a chance node of a game tree. + +%You can also change the node styles, like \verb|\setistDecisionNodeStyle[blue]{3pt}|. + +\xbigskip1 +Additional convenient node aliases are also provided: \ixw{box node}, \ixw{square node}, and \ixw{oval node}. + +\begin{tcblisting}{listing only,breakable} +% some more aliases +\tikzset{box node/.style=rectangle node} +\tikzset{square node/.style=rectangle node} +\tikzset{oval node/.style=ellipse node} +\end{tcblisting} + +For aliases, you can also change the node styles, like \verb|\setistDecisionNodeStyle[blue]{3pt}| or \verb|\setistBoxNodeStyle{3pt}[green][.5]|. + +\subsubsection{Your own node styles: \protect\cmd{\setistNewNodeStyle}} + +You can create your own node style by \icmd{\setistNewNodeStyle}. + +\begin{tcblisting}{listing only} +% \setistNewNodeStyle +% syntax: + \setistNewNodeStyle{