diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/egameps |
Initial commit
Diffstat (limited to 'macros/latex/contrib/egameps')
-rw-r--r-- | macros/latex/contrib/egameps/README | 6 | ||||
-rw-r--r-- | macros/latex/contrib/egameps/egameps.pdf | bin | 0 -> 144082 bytes | |||
-rw-r--r-- | macros/latex/contrib/egameps/egameps.sty | 1611 | ||||
-rw-r--r-- | macros/latex/contrib/egameps/egameps.tex | 1549 |
4 files changed, 3166 insertions, 0 deletions
diff --git a/macros/latex/contrib/egameps/README b/macros/latex/contrib/egameps/README new file mode 100644 index 0000000000..3e3362641d --- /dev/null +++ b/macros/latex/contrib/egameps/README @@ -0,0 +1,6 @@ +The style is intended to have enough features to typeset any +extensive game with relative ease. The facilities of +PSTricks are used. +(An older version of the package, which uses the LaTeX picture +environment rather than PSTricks and consequently has many fewer +features is available on the package home page.)
\ No newline at end of file diff --git a/macros/latex/contrib/egameps/egameps.pdf b/macros/latex/contrib/egameps/egameps.pdf Binary files differnew file mode 100644 index 0000000000..bb1065a843 --- /dev/null +++ b/macros/latex/contrib/egameps/egameps.pdf diff --git a/macros/latex/contrib/egameps/egameps.sty b/macros/latex/contrib/egameps/egameps.sty new file mode 100644 index 0000000000..0e7360080b --- /dev/null +++ b/macros/latex/contrib/egameps/egameps.sty @@ -0,0 +1,1611 @@ +% egameps.sty +% <title>LaTeX style file for typesetting extensive games (using Postscript)</title> +% Macros to draw extensive games, using the PSTricks package +% macros (but retaining TeX's integer arithmetic). +% +% See egameps.pdf for documentation. +% By Martin J. Osborne +% martin.osborne@utoronto.ca +% http://www.economics.utoronto.ca/osborne +% Version 1.1, 2004/6/19 +% +% Defaults. (Changes made here will be global. To change locally, use +% optional arguments of functions.) +\def\@branchcolor{black} % color of branches +\def\@branchstyle{solid} % style of branches +\def\@branchwidth{0.8pt} % width of branches +% +% Style of arcs in \ctmbarc +\def\egarclinestyle{solid} +\def\egarclinewidth{0.6pt} +\def\egarclinecolor{black} +% +\newgray{verylightgray}{.9} +\def\ctmfillcolor{verylightgray} % color of triangle for continuum of branches +\def\egnode{\pscircle*{5}} % node +\def\eginode{\pscircle[linewidth=0.4pt]{5}} % initial node +\def\infosetdot{\pscircle*{2.5}} +\def\infosetdotsep{20} % dot spacing (n means: n times unitlength) +\newdimen\egplayerlabelsep +\egplayerlabelsep=1mm +\newdimen\egplayerboxsep +\egplayerboxsep=0mm +\newdimen\egactionlabelsep +\egactionlabelsep=0.7mm +\newdimen\egactionboxsep +\egactionboxsep=0mm +\newdimen\egpayoffboxsep +\egpayoffboxsep=0mm +\newdimen\egpayofflabelsep +\egpayofflabelsep=2mm +\def\egalboxlinestyle{none} +\def\egalboxlinecolor{black} +\def\egalboxfillstyle{none} +\def\egalboxfillcolor{white} +\def\egpayboxlinestyle{none} +\def\egpayboxlinecolor{black} +\def\egpayboxfillstyle{none} +\def\egpayboxfillcolor{white} +\def\egplboxlinestyle{none} +\def\egplboxlinecolor{black} +\def\egplboxfillstyle{none} +\def\egplboxfillcolor{white} + +\def\egalpos{o} % position of action labels: offset +\def\egalbox{f} % box for action labels: framebox +\def\egpaybox{f} % box for payoff labels: framebox +\def\egplbox{f} % box for player labels: framebox +\def\egarrowstyle{n} % style of arrows on branches: none + +\newif\ifinitial + +\newpsobject{branchline}{psline}% + {linecolor=\@branchcolor,linestyle=\@branchstyle,linewidth=\@branchwidth} + +\newcount\@egxnum +\newcount\@egxxnum +\newcount\@egxxxnum +\newcount\@egxxxxnum +\newcount\@egynum +\newcount\@egyynum +\newcount\@egyyynum +\newcount\@egyyyynum +\newdimen\@egrad +\newdimen\@egxdim +\newdimen\@egydim +\newcount\@@egxnum +\newcount\@@egxxnum +\newcount\@@egxxxnum +\newcount\@@egynum +\newcount\@@egyynum +\newcount\@@egyyynum +\newcount\@eghnum +\newcount\@egvnum +\newcount\@egabshnum +\newcount\@egabsvnum +\newcount\@eghdistance +\newcount\@tempcntx +\newcount\@tempcnty +\newcount\egalhshift +\newcount\egalvshift + +% Command to change default direction +\newcommand{\egdirection}[1]{% + \if#1d\def\@egdefdirection{d} + \else\if#1u\def\@egdefdirection{u} + \else\if#1r\def\@egdefdirection{r} + \else\if#1l\def\@egdefdirection{l} + \else\@egame@warning{egdirection '#1' undefined; using 'd'} + \def\@egdefdirection{d} + \fi\fi\fi\fi% +} +% Default direction is down +\def\@egdefdirection{d} + +\def\@egame@warning#1{% + \GenericWarning{% + \space\space\space\@spaces\@spaces\@spaces + }{% + egameps warning: #1% + }% +} + +%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% Draw a branch +%%%%%%%%%%%%%%%%%%%%%%%% +% +% draw a branch in PSTricks style #1 from (#2,#3) to (#4,#5), putting the +% action label #6 above the branch if #7 is u (to the right if vertical +% branch) and below it if #7 is d (to the left if vertical branch), and the +% payoff label #8 according in the appropriate position given \egdirection + +\def\@egdrawbranch{% + \@ifnextchar[{\@drawbrancho}{\@drawbranchn} +} + +% #1: PSTricks style (linestyle, linecolor, etc.) +% (#2,#3): starting point +% (#4,#5): ending point +% #6: action label +% #7: action label position (c (center), o (outside), i (inside)) +% #8: payoff label +\def\@drawbrancho[#1](#2,#3)(#4,#5)#6#7{% + \@@egxnum=#2\@@egynum=#3 + \@@egxxnum=#4\@@egyynum=#5 + \if\egarrowstyle e + \branchline[#1]{->}(\@@egxnum,\@@egynum)(\@@egxxnum,\@@egyynum) + \else + \branchline[#1](\@@egxnum,\@@egynum)(\@@egxxnum,\@@egyynum) + \if\egarrowstyle m + \@@egxxxnum=\@@egxnum + \advance\@@egxxxnum by\@@egxxnum + \divide\@@egxxxnum by2 + \@@egyyynum=\@@egynum + \advance\@@egyyynum by\@@egyynum + \divide\@@egyyynum by2 + \branchline[#1]{->}(\@@egxnum,\@@egynum)(\@@egxxxnum,\@@egyyynum) + \fi + \fi + \@drawactionlabel{#6}{#7} + \@ifnextchar[{\@drawpayoffs}{} +} + +\def\@drawbranchn(#1,#2)(#3,#4)#5#6{% + \@@egxnum=#1\@@egynum=#2 + \@@egxxnum=#3\@@egyynum=#4 + \if\egarrowstyle e + \branchline{->}(\@@egxnum,\@@egynum)(\@@egxxnum,\@@egyynum) + \else + \branchline(\@@egxnum,\@@egynum)(\@@egxxnum,\@@egyynum) + \if\egarrowstyle m + \@@egxxxnum=\@@egxnum + \advance\@@egxxxnum by\@@egxxnum + \divide\@@egxxxnum by2 + \@@egyyynum=\@@egynum + \advance\@@egyyynum by\@@egyynum + \divide\@@egyyynum by2 + \branchline{->}(\@@egxnum,\@@egynum)(\@@egxxxnum,\@@egyyynum) + \fi + \fi + \@drawactionlabel{#5}{#6} + \@ifnextchar[{\@drawpayoffs}{} +} + +% #1: action label +% #2: action label position +% position action label relative to reference point (\@@egxnum, \@@egynum) +\def\@drawactionlabel#1#2{% + \psset{framesep=\egactionboxsep} + \fboxrule 0pt\fboxsep\egactionlabelsep + \advance\@@egxnum by\@@egxxnum + \divide\@@egxnum by2 + \advance\@@egynum by\@@egyynum + \divide\@@egynum by2 +% shifts + \@tempcntx=\@@egxnum% procedure changes \@@egxnum and \@@egynum, so + \@tempcnty=\@@egynum% save their original values + \ifnum\egalvshift=0 + \ifnum\@@egxxnum=\@tempcntx + \else\ifnum\@@egxxnum>\@tempcntx + \advance\@@egxnum by\egalhshift + \@tempcnta=\egalhshift + \multiply\@tempcnta by\@egabsvnum + \divide\@tempcnta by\@egabshnum + \ifnum\@@egyynum>\@tempcnty + \advance\@@egynum by\@tempcnta + \else + \advance\@@egynum by-\@tempcnta + \fi + \else\ifnum\@@egxxnum<\@tempcntx + \if\@egdirection l + \advance\@@egxnum by\egalhshift + \else + \advance\@@egxnum by-\egalhshift + \fi + \@tempcnta=\egalhshift + \multiply\@tempcnta by\@egabsvnum + \divide\@tempcnta by\@egabshnum + \if\@egdirection l + \ifnum\@@egyynum>\@tempcnty + \advance\@@egynum by-\@tempcnta + \else + \advance\@@egynum by\@tempcnta + \fi + \else + \ifnum\@@egyynum>\@tempcnty + \advance\@@egynum by\@tempcnta + \else + \advance\@@egynum by-\@tempcnta + \fi + \fi + \fi\fi\fi + \else\ifnum\egalhshift=0 + \ifnum\@@egyynum=\@tempcnty + \else\ifnum\@@egyynum>\@tempcnty + \advance\@@egynum by\egalvshift + \@tempcnta=\egalvshift + \multiply\@tempcnta by\@eghnum + \divide\@tempcnta by\@egvnum + \ifnum\@@egxxnum>\@tempcntx + \advance\@@egxnum by\@tempcnta + \else + \advance\@@egxnum by-\@tempcnta + \fi + \else\ifnum\@@egyynum<\@tempcnty + \if\@egdirection d + \advance\@@egynum by\egalvshift + \else + \advance\@@egynum by-\egalvshift + \fi + \@tempcnta=\egalvshift + \multiply\@tempcnta by\@eghnum + \divide\@tempcnta by\@egvnum + \if\@egdirection d + \ifnum\@@egxxnum>\@tempcntx + \advance\@@egxnum by-\@tempcnta + \else + \advance\@@egxnum by\@tempcnta + \fi + \else + \ifnum\@@egxxnum>\@tempcntx + \advance\@@egxnum by\@tempcnta + \else + \advance\@@egxnum by-\@tempcnta + \fi + \fi + \fi\fi\fi + \else + \if\@egdirection d + \ifnum\@@egxxnum>\@tempcntx + \advance\@@egxnum by\egalhshift + \else + \advance\@@egxnum by-\egalhshift + \fi + \else\if\@egdirection u + \ifnum\@@egxxnum>\@tempcntx + \advance\@@egxnum by\egalhshift + \else + \advance\@@egxnum by-\egalhshift + \fi + \else\if\@egdirection r + \advance\@@egxnum by\egalhshift + \else\if\@egdirection l + \advance\@@egxnum by\egalhshift + \fi\fi\fi\fi + \if\@egdirection d + \advance\@@egynum by\egalvshift + \else\if\@egdirection u + \advance\@@egynum by\egalvshift + \else\if\@egdirection r + \ifnum\@@egyynum>\@tempcnty + \advance\@@egynum by\egalvshift + \else + \advance\@@egynum by-\egalvshift + \fi + \else\if\@egdirection l + \ifnum\@@egyynum>\@tempcnty + \advance\@@egynum by\egalvshift + \else + \advance\@@egynum by-\egalvshift + \fi + \fi\fi\fi\fi + \fi\fi +% + \if\egalbox f + \def\@egalbox{\psframebox[linestyle=\egalboxlinestyle,% + linecolor=\egalboxlinecolor,fillstyle=\egalboxfillstyle,% + fillcolor=\egalboxfillcolor]} + \else\if\egalbox c + \def\@egalbox{\pscirclebox[linestyle=\egalboxlinestyle,% + linecolor=\egalboxlinecolor,fillstyle=\egalboxfillstyle,% + fillcolor=\egalboxfillcolor]} + \fi\fi + \if#2c + \setbox0\hbox{\fbox{\@egalbox{#1}}} + \psset{framesep=\egactionlabelsep} + \rput*(\@@egxnum,\@@egynum){\box0} + \else\if#2o % outside + \if\@egdirection d + \ifnum\@tempcntx<\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[b](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[bl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx>\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[b](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[br](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx=\@@egxxnum + \rput[l](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \else\if\@egdirection u + \ifnum\@tempcntx<\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[t](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx>\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[t](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tr](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx=\@@egxxnum + \rput[l](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \else\if\@egdirection r + \ifnum\@tempcnty<\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[r](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[br](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty>\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[r](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tr](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty=\@@egyynum + \rput[b](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \else\if\@egdirection l + \ifnum\@tempcnty<\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[l](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[bl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty>\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[l](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty=\@@egyynum + \rput[b](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \fi\fi\fi\fi + \else\if#2i % inside + \if\@egdirection d + \ifnum\@tempcntx<\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[t](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tr](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx>\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[t](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx=\@@egxxnum + \rput[r](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \else\if\@egdirection u + \ifnum\@tempcntx<\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[b](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[br](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx>\@@egxxnum + \ifnum\@tempcnty=\@@egyynum + \rput[b](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[bl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcntx=\@@egxxnum + \rput[r](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \else\if\@egdirection r + \ifnum\@tempcnty<\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[l](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty>\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[l](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[bl](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty=\@@egyynum + \rput[t](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \else\if\@egdirection l + \ifnum\@tempcnty<\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[r](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[tr](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty>\@@egyynum + \ifnum\@tempcntx=\@@egxxnum + \rput[r](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \else + \rput[br](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi + \else\ifnum\@tempcnty=\@@egyynum + \rput[t](\@@egxnum,\@@egynum){\fbox{\@egalbox{#1}}} + \fi\fi\fi + \fi\fi\fi\fi + \fi\fi\fi +} + +\def\@drawpayoffs[#1]{% + \ifx#1\@empty + \else + \psset{framesep=\egpayoffboxsep} + \fboxrule 0pt\fboxsep\egpayofflabelsep + \if\egpaybox f + \def\@egpaybox{\psframebox[linestyle=\egpayboxlinestyle,% + linecolor=\egpayboxlinecolor,fillstyle=\egpayboxfillstyle,% + fillcolor=\egpayboxfillcolor]} + \else\if\egpaybox c + \def\@egpaybox{\pscirclebox[linestyle=\egpayboxlinestyle,% + linecolor=\egpayboxlinecolor,fillstyle=\egpayboxfillstyle,% + fillcolor=\egpayboxfillcolor]} + \fi\fi + \if\@egdirection d + \rput[t](\@@egxxnum,\@@egyynum){\fbox{\@egpaybox{#1}}} + \else\if\@egdirection u + \rput[b](\@@egxxnum,\@@egyynum){\fbox{\@egpaybox{#1}}} + \else\if\@egdirection r + \rput[l](\@@egxxnum,\@@egyynum){\fbox{\@egpaybox{#1}}} + \else\if\@egdirection l + \rput[r](\@@egxxnum,\@@egyynum){\fbox{\@egpaybox{#1}}} + \fi\fi\fi\fi + \fi +} + +\def\@egdrawnode#1{ + \psset{framesep=1pt} + \ifinitial\rput*(\@egxnum,\@egynum){\eginode}\initialfalse + \else\rput*(\@egxnum,\@egynum){\egnode}% + \fi + \psset{framesep=\egplayerboxsep} + \fboxrule 0pt\fboxsep\egplayerlabelsep + \if\@branchplp o + \rput*(\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else\if\@egdirection d + \if\@branchplp l + \rput[br](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else\if\@branchplp r + \rput[bl](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else + \rput[b](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \fi\fi + \else\if\@egdirection u + \if\@branchplp l + \rput[tr](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else\if\@branchplp r + \rput[tl](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else + \rput[t](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \fi\fi + \else\if\@egdirection r + \if\@branchplp u + \rput[br](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else\if\@branchplp d + \rput[tr](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else + \rput[r](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \fi\fi + \else\if\@egdirection l + \if\@branchplp u + \rput[bl](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else\if\@branchplp d + \rput[tl](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \else + \rput[l](\@egxnum,\@egynum){\fbox{\@egplbox{#1}}} + \fi\fi + \fi\fi\fi\fi\fi +} + +%%%%%%%%%%%%%%%%%%%%% +%%%%%% \putbranch +%%%%%%%%%%%%%%%%%%%%% + +% \putbranch and the two macros it calls define the parameters +% \@egxnum +% \@egynum +% \@eghnum +% \@egvnum +% \@egabshnum (absolute value of \@eghnum) +% \@egabsvnum (absolute value of \@egvnum) +% \@egdirection +% \@eghdistance (for direction d, horizontal distance from node to outer +% branch (the single branch in the case of one, and either branch in +% the case of two)) +% to be used by \ib, \iib, \iiib, and \ctmb. + +\def\putbranch(#1,#2)(#3,#4){% + \egalhshift=0% + \egalvshift=0% + \@egxnum=#1\@egynum=#2\@eghnum=#3\@egvnum=#4% +% define absolute values of \@eghnum and \@egvnum + \ifnum\@eghnum<0 + \@egabshnum=-\@eghnum + \else\@egabshnum=\@eghnum\fi + \ifnum\@egvnum<0 + \@egabsvnum=-\@egvnum + \else\@egabsvnum=\@egvnum\fi +%% player label box + \if\egplbox f + \gdef\@egplbox{\psframebox[linestyle=\egplboxlinestyle,% + linecolor=\egplboxlinecolor,fillstyle=\egplboxfillstyle,% + fillcolor=\egplboxfillcolor]} + \else\if\egplbox c + \gdef\@egplbox{\pscirclebox[linestyle=\egplboxlinestyle,% + linecolor=\egplboxlinecolor,fillstyle=\egplboxfillstyle,% + fillcolor=\egplboxfillcolor]} + \else + \@egame@warning{egplbox style '\egplbox' undefined; using c} + \gdef\@egplbox{\pscirclebox[linestyle=\egplboxlinestyle,% + linecolor=\egplboxlinecolor,fillstyle=\egplboxfillstyle,% + fillcolor=\egplboxfillcolor]} + \fi\fi +%% + \@ifnextchar[{\@putbrancho(#1,#2)(#3,#4)}{\@putbranch(#1,#2)(#3,#4)}% +} + +\def\@putbrancho(#1,#2)(#3,#4)[#5]#6{% + \def\@egdirection{#5}\@eghdistance=#6% +} + +\def\@putbranch(#1,#2)(#3,#4)#5{% + \def\@egdirection{\@egdefdirection}\@eghdistance=#5% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% ONE BRANCH +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% One branch + +\def\ib{% + \if\@egdirection d + \@egvnum=-\@egabsvnum + \else\if\@egdirection u + \@egvnum=\@egabsvnum + \else\if\@egdirection r + \@eghnum=\@egabshnum + \else\if\@egdirection l + \@eghnum=-\@egabshnum + \fi\fi\fi\fi + \@egxxnum=\@egxnum + \ifnum\@eghnum=0 + \@egyynum=\@egynum + \ifnum\@egvnum<0 + \advance\@egyynum by-\@eghdistance + \else + \advance\@egyynum by\@eghdistance + \fi + \else + \@egyynum=\@egabsvnum + \multiply\@egyynum by\@eghdistance + \divide\@egyynum by\@egabshnum + \ifnum\@egvnum<0 + \advance\@egyynum by-\@egynum + \multiply\@egyynum by-1 + \else + \advance\@egyynum by\@egynum + \fi + \ifnum\@eghnum<0 + \advance\@egxxnum by-\@eghdistance + \else + \advance\@egxxnum by\@eghdistance + \fi + \fi + \@ifnextchar[{\@ibpsto}{\@ibpstno} +} + +%%% first argument is option list + +% #1: list of options to be ultimately passed to \psline (via \branchline) +% #2: player label +\def\@ibpsto[#1]#2{% + \@ifnextchar[{\@ibo{#1}{#2}}{\@ib{#1}{#2}}% +} + +% #1: list of options +% #2: player label +% #3: player label position +% #4: action label +\def\@ibo#1#2[#3]#4{% + \def\@branchplp{#3} + \@ifnextchar[{\@ibot{#1}{#2}{#4}}{\@ibotn{#1}{#2}{#4}}% +} + +% #1: list of options +% #2: player label +% #3: action label +\def\@ib#1#2#3{% + \def\@branchplp{t} + \@ifnextchar[{\@ibot{#1}{#2}{#3}}{\@ibotn{#1}{#2}{#3}}% +} + +% #1: list of options +% #2: player label +% #3: action label +\def\@ibotn#1#2#3{% + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}{\egalpos} + \@egdrawnode{#2}% +} + +% #1: list of options +% #2: player label +% #3: action label +% #4: action label position OR payoffs +\def\@ibot#1#2#3[#4]{% + \if#4c\def\@tempegalpos{1} + \else\if#4o\def\@tempegalpos{1} + \else\if#4i\def\@tempegalpos{1} + \else\def\@tempegalpos{0} % last argument is payoffs, not label position + \fi\fi\fi + \@ifnextchar[{\@ibt{#1}{#2}{#3}{#4}}{\@ibtn{#1}{#2}{#3}{#4}}% +} + +% #1: list of options +% #2: player label +% #3: action label +% #4: action label position +% #5: payoffs +\def\@ibt#1#2#3#4[#5]{% + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}% + {#4}[#5] + \@egdrawnode{#2}% +} + +% #1: list of options +% #2: player label +% #3: action label +% #4: action label position if \@tempalpos=1, otherwise payoff +\def\@ibtn#1#2#3#4{% + \if\@tempegalpos 0 + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}% + {\egalpos}[#4] + \@egdrawnode{#2}% + \else + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}{#4} + \@egdrawnode{#2}% + \fi +} + +%%% first argument not an option list + +% #1: player label +\def\@ibpstno#1{% + \@ifnextchar[{\@ibox{#1}}{\@ibx{#1}}% +} + +% #1: player label +% #2: player label position +% #3: action label +\def\@ibox#1[#2]#3{% + \def\@branchplp{#2} + \@ifnextchar[{\@ibotx{#1}{#3}}{\@ibotnx{#1}{#3}}% +} + +% #1: player label +% #2: action label +\def\@ibx#1#2{% + \def\@branchplp{t} + \@ifnextchar[{\@ibotx{#1}{#2}}{\@ibotnx{#1}{#2}}% +} + +% #1: player label +% #2: action label +\def\@ibotnx#1#2{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#2}{\egalpos} + \@egdrawnode{#1}% +} + +% #1: player label +% #2: action label +% #3: action label position OR payoffs +\def\@ibotx#1#2[#3]{% + \if#3c\def\@tempegalpos{1} + \else\if#3o\def\@tempegalpos{1} + \else\if#3i\def\@tempegalpos{1} + \else\def\@tempegalpos{0} % last argument is payoffs, not label position + \fi\fi\fi + \@ifnextchar[{\@ibtx{#1}{#2}{#3}}{\@ibtnx{#1}{#2}{#3}}% +} + +% #1: player label +% #2: action label +% #3: action label position +% #4: payoffs +\def\@ibtx#1#2#3[#4]{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#2}% + {#3}[#4] + \@egdrawnode{#1}% +} + +% #1: player label +% #2: action label +% #3: payoff +\def\@ibtnx#1#2#3{% + \if\@tempegalpos 0 + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#2}% + {\egalpos}[#3] + \@egdrawnode{#1}% + \else + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#2}{#3} + \@egdrawnode{#1}% + \fi +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% TWO BRANCHES +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Two branches + +% calculate \@egxxnum, \@egxxxnum, \@egyynum, and \@egyyynum from \@egxnum etc. +% (used also in \ctmb) +\def\@egxyiicalc{ + \@eghnum=\@egabshnum + \@egvnum=\@egabsvnum + \@egxxnum=\@egxnum + \@egxxxnum=\@egxnum + \ifnum\@eghnum=0 + \@egyynum=\@egynum + \@egyyynum=\@egynum + \if\@egdirection d + \advance\@egyynum by-\@eghdistance + \advance\@egyyynum by-\@eghdistance + \else\if\@egdirection u + \advance\@egyynum by\@eghdistance + \advance\@egyyynum by\@eghdistance + \else + \advance\@egyynum by-\@eghdistance + \advance\@egyyynum by\@eghdistance + \fi\fi + \else + \@egyynum=\@egabsvnum + \multiply\@egyynum by\@eghdistance + \divide\@egyynum by\@egabshnum + \if\@egdirection d + \advance\@egyynum by-\@egynum + \multiply\@egyynum by-1 + \@egyyynum=\@egyynum + \advance\@egxxnum by\@eghdistance + \advance\@egxxxnum by-\@eghdistance + \else\if\@egdirection u + \advance\@egyynum by\@egynum + \@egyyynum=\@egyynum + \advance\@egxxnum by\@eghdistance + \advance\@egxxxnum by-\@eghdistance + \else\if\@egdirection r + \@egyyynum=\@egyynum + \advance\@egyynum by-\@egynum + \multiply\@egyynum by-1 + \advance\@egyyynum by\@egynum + \advance\@egxxnum by\@eghdistance + \advance\@egxxxnum by\@eghdistance + \else\if\@egdirection l + \@egyyynum=\@egyynum + \advance\@egyynum by-\@egynum + \multiply\@egyynum by-1 + \advance\@egyyynum by\@egynum + \advance\@egxxnum by-\@eghdistance + \advance\@egxxxnum by-\@eghdistance + \fi\fi\fi\fi + \fi +} + +\def\iib{% + \@egxyiicalc + \@ifnextchar[{\@iibpsto}{\@iibpstno} +} + +%%% options present + +% #1: list of options to be ultimately passed to \psline (via \branchline) +\def\@iibpsto[#1]{% + \@ifnextchar[{\@iibao{#1}}{\@iiba{#1}}% +} + +% #1: list of options for one branch +% #2: list of options for other branch +% #3: player label +\def\@iibao#1[#2]#3{% + \@ifnextchar[{\@iibo{#1}{#2}{#3}}{\@iib{#1}{#2}{#3}}% +} + +% #1: list of options for both branches +% #2: player label +\def\@iiba#1#2{% + \@ifnextchar[{\@iibo{#1}{#1}{#2}}{\@iib{#1}{#1}{#2}}% +} + +% #1: list of options for one branch +% #2: list of options for other branch +% #3: player label +% #4: player label position +% #5: action label 1 +% #6: action label 2 +\def\@iibo#1#2#3[#4]#5#6{% + \def\@branchplp{#4} + \@ifnextchar[{\@iibot{#1}{#2}{#3}{#5}{#6}}{\@iibotn{#1}{#2}{#3}{#5}{#6}}% +} + +% #1: list of options for one branch +% #2: list of options for other branch +% #3: player label +% #4: action label 1 +% #5: action label 2 +\def\@iib#1#2#3#4#5{% + \def\@branchplp{t} + \@ifnextchar[{\@iibot{#1}{#2}{#3}{#4}{#5}}{\@iibotn{#1}{#2}{#3}{#4}{#5}}% +} + +% #1: list of options for one branch +% #2: list of options for other branch +% #3: player label +% #4: action label 1 +% #5: action label 2 +\def\@iibotn#1#2#3#4#5{% + \@egdrawbranch[#2](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}{\egalpos} + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#4}{\egalpos} + \@egdrawnode{#3}% +} + +% #1: list of options +% #2: list of options +% #3: player label +% #4: action label 1 +% #5: action label 2 +% #6: action label position OR payoffs +\def\@iibot#1#2#3#4#5[#6]{% + \@ifnextchar[{\@iibt{#1}{#2}{#3}{#4}{#5}{#6}}{\@iibtn{#1}{#2}{#3}{#4}% +{#5}{#6}}% +} + +% if at least two optional arguments at end, check for third argument +% #1: list of options for one branch +% #2: list of options for other branch +% #3: player label +% #4: action label 1 +% #5: action label 2 +% #6: action label position or payoffs +% #7: payoffs +\def\@iibt#1#2#3#4#5#6[#7]{% + \@ifnextchar[{\@iibtz{#1}{#2}{#3}{#4}{#5}{#6}{#7}}{\@iibtnz{#1}{#2}{#3}% +{#4}{#5}{#6}{#7}}% +} + +% 3 arguments at end +% #1: list of options for one branch +% #2: list of options for other branch +% #3: player label +% #4: action label 1 +% #5: action label 2 +% #6: action label position +% #7: payoffs +% #8: payoffs +\def\@iibtz#1#2#3#4#5#6#7[#8]{% + \@egdrawbranch[#2](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}% + {#6}[#8] + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#4}% + {#6}[#7] + \@egdrawnode{#3}% +} + +% 2 arguments at end, so must be payoffs +% #1: list of options for one branch +% #2: list of options for other branch +% #3: player label +% #4: action label 1 +% #5: action label 2 +% #6: payoffs +% #7: payoffs +\def\@iibtnz#1#2#3#4#5#6#7{% + \@egdrawbranch[#2](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}% + {\egalpos}[#7] + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#4}% + {\egalpos}[#6] + \@egdrawnode{#3}% +} + +% 1 argument at end, so must be egalpos +% #1: list of options for one branch +% #2: list of options for one branch +% #3: player label +% #4: action label 1 +% #5: action label 2 +% #6: action label position +\def\@iibtn#1#2#3#4#5#6{% + \@egdrawbranch[#2](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}{#6} + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#4}{#6} + \@egdrawnode{#3}% +} + +%%% no options present + +% #1: player label +\def\@iibpstno#1{% + \@ifnextchar[{\@iibox{#1}}{\@iibx{#1}}% +} + +% #1: player label +% #2: player label position +% #3: action label 1 +% #4: action label 2 +\def\@iibox#1[#2]#3#4{% + \def\@branchplp{#2} + \@ifnextchar[{\@iibotx{#1}{#3}{#4}}{\@iibotnx{#1}{#3}{#4}}% +} + +% #1: player label +% #2: action label 1 +% #3: action label 2 +\def\@iibx#1#2#3{% + \def\@branchplp{t} + \@ifnextchar[{\@iibotx{#1}{#2}{#3}}{\@iibotnx{#1}{#2}{#3}}% +} + +% #1: player label +% #2: action label +% #3: action label +\def\@iibotnx#1#2#3{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}{\egalpos} + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}{\egalpos} + \@egdrawnode{#1}% +} + +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label position OR payoffs +\def\@iibotx#1#2#3[#4]{% + \@ifnextchar[{\@iibtx{#1}{#2}{#3}{#4}}{\@iibtnx{#1}{#2}{#3}{#4}}% +} + +% at least 2 arguments at end, so check for third +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label position or payoffs +% #5: payoffs +\def\@iibtx#1#2#3#4[#5]{% + \@ifnextchar[{\@iibtxz{#1}{#2}{#3}{#4}{#5}}{\@iibtnxz{#1}{#2}{#3}% +{#4}{#5}}% +} + +% 2 arguments at end +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: payoffs +% #5: payoffs +\def\@iibtnxz#1#2#3#4#5{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}% + {\egalpos}[#5] + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}% + {\egalpos}[#4] + \@egdrawnode{#1}% +} + +% 3 arguments at end +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label position +% #5: payoffs +% #6: payoffs +\def\@iibtxz#1#2#3#4#5[#6]{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}{#4}[#6] + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}{#4}[#5] + \@egdrawnode{#1}% +} + +% 1 argument at end, so must be egalpos +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label position +\def\@iibtnx#1#2#3#4{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#3}% + {#4} + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}% + {#4} + \@egdrawnode{#1}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% THREE BRANCHES +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% calculate coordinates for third (middle) branch +\def\@egxyiiicalc{% + \if\@egdirection d + \@egxxxxnum=\@egxnum + \ifnum\@eghnum=0 + \@egyyyynum=\@egynum + \advance\@egyyyynum by-\@eghdistance + \else + \@egyyyynum=\@eghdistance + \multiply\@egyyyynum by\@egabsvnum + \divide\@egyyyynum by\@egabshnum + \advance\@egyyyynum by-\@egynum + \multiply\@egyyyynum by-1 + \fi + \else\if\@egdirection u + \@egxxxxnum=\@egxnum + \ifnum\@eghnum=0 + \@egyyyynum=\@egynum + \advance\@egyyyynum by\@eghdistance + \else + \@egyyyynum=\@eghdistance + \multiply\@egyyyynum by\@egabsvnum + \divide\@egyyyynum by\@egabshnum + \advance\@egyyyynum by\@egynum + \fi + \else\if\@egdirection r + \@egyyyynum=\@egynum + \@egxxxxnum=\@egxnum + \advance\@egxxxxnum by\@eghdistance + \else\if\@egdirection l + \@egyyyynum=\@egynum + \@egxxxxnum=\@egxnum + \advance\@egxxxxnum by-\@eghdistance + \fi\fi\fi\fi +} + +\def\iiib{% + \@egxyiicalc + \@egxyiiicalc + \@ifnextchar[{\@iiibpsto}{\@iiibpstno} +} + +%%% options present + +% #1: list of options to be ultimately passed to \psline (via \branchline) +% #2: player label +\def\@iiibpsto[#1]#2{% + \@ifnextchar[{\@iiibo{#1}{#2}}{\@iiib{#1}{#2}}% +} + +% #1: list of options +% #2: player label +% #3: player label position +% #4: action label 1 +% #5: action label 2 +% #6: action label 3 +\def\@iiibo#1#2[#3]#4#5#6{% + \def\@branchplp{#3} + \@ifnextchar[{\@iiibot{#1}{#2}{#4}{#5}{#6}}{\@iiibotn{#1}{#2}{#4}% +{#5}{#6}}% +} + +% #1: list of options for one branch +% #2: player label +% #3: action label 1 +% #4: action label 2 +% #5: action label 3 +\def\@iiib#1#2#3#4#5{% + \def\@branchplp{t} + \@ifnextchar[{\@iiibot{#1}{#2}{#3}{#4}{#5}}{\@iiibotn{#1}{#2}{#3}% +{#4}{#5}}% +} + +% #1: list of options for one branch +% #2: player label +% #3: action label 1 +% #4: action label 2 +% #5: action label 3 +\def\@iiibotn#1#2#3#4#5{% + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}{\egalpos} + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#3}{\egalpos} + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#4}% +{\egalpos} + \@egdrawnode{#2}% +} + +% #1: list of options +% #2: player label +% #3: action label 1 +% #4: action label 2 +% #5: action label 3 +% #6: action label position OR payoffs +\def\@iiibot#1#2#3#4#5[#6]{% + \@ifnextchar[{\@iiibt{#1}{#2}{#3}{#4}{#5}{#6}}{\@iiibtn{#1}{#2}{#3}{#4}% +{#5}{#6}}% +} + +% if at least two optional arguments at end, check for third argument +% #1: list of options +% #2: player label +% #3: action label 1 +% #4: action label 2 +% #5: action label 3 +% #6: action label position or payoffs +% #7: payoffs +% #8: payoffs +\def\@iiibt#1#2#3#4#5#6[#7][#8]{% + \@ifnextchar[{\@iiibtz{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% +{\@iiibtnz{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}}% +} + +% 4 arguments at end +% #1: list of options +% #2: player label +% #3: action label 1 +% #4: action label 2 +% #5: action label 3 +% #6: action label position +% #7: payoffs +% #8: payoffs +% #9: payoffs +\def\@iiibtz#1#2#3#4#5#6#7#8[#9]{% + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}% + {#6}[#9] + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#3}% + {#6}[#7] + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#4}% + {#6}[#8] + \@egdrawnode{#2}% +} + +% 3 arguments at end, so must be payoffs +% #1: list of options +% #2: player label +% #3: action label 1 +% #4: action label 2 +% #5: action label 3 +% #6: payoffs +% #7: payoffs +% #8: payoffs +\def\@iiibtnz#1#2#3#4#5#6#7#8{% + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}% + {\egalpos}[#8] + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#3}% + {\egalpos}[#6] + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#4}% + {\egalpos}[#7] + \@egdrawnode{#2}% +} + +% 1 argument at end, so must be egalpos +% #1: list of options for one branch +% #2: player label +% #3: action label 1 +% #4: action label 2 +% #5: action label 3 +% #6: action label position +\def\@iiibtn#1#2#3#4#5#6{% + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#5}{#6} + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#3}{#6} + \@egdrawbranch[#1](\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#4}{#6} + \@egdrawnode{#1}% +} + +%%% no options present + +% #1: player label +\def\@iiibpstno#1{% + \@ifnextchar[{\@iiibox{#1}}{\@iiibx{#1}}% +} + +% #1: player label +% #2: player label position +% #3: action label 1 +% #4: action label 2 +% #5: action label 2 +\def\@iiibox#1[#2]#3#4#5{% + \def\@branchplp{#2} + \@ifnextchar[{\@iiibotx{#1}{#3}{#4}{#5}}{\@iiibotnx{#1}{#3}{#4}{#5}}% +} + +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label 3 +\def\@iiibx#1#2#3#4{% + \def\@branchplp{t} + \@ifnextchar[{\@iiibotx{#1}{#2}{#3}{#4}}{\@iiibotnx{#1}{#2}{#3}{#4}}% +} + +% #1: player label +% #2: action label +% #3: action label +% #4: action label +\def\@iiibotnx#1#2#3#4{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#4}{\egalpos} + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}{\egalpos} + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#3}{\egalpos} + \@egdrawnode{#1}% +} + +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label 3 +% #5: action label position OR payoffs +\def\@iiibotx#1#2#3#4[#5]{% + \@ifnextchar[{\@iiibtx{#1}{#2}{#3}{#4}{#5}}{\@iiibtnx{#1}{#2}{#3}% +{#4}{#5}}% +} + +% at least 2 arguments at end, so check for third +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label 3 +% #5: action label position or payoffs +% #6: payoffs +% #7: payoffs +\def\@iiibtx#1#2#3#4#5[#6][#7]{% + \@ifnextchar[{\@iiibtxz{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% +{\@iiibtnxz{#1}{#2}{#3}{#4}{#5}{#6}{#7}}% +} + +% 3 arguments at end +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label 3 +% #5: payoffs +% #6: payoffs +% #7: payoffs +\def\@iiibtnxz#1#2#3#4#5#6#7{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#4}% + {\egalpos}[#7] + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}% + {\egalpos}[#5] + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#3}% + {\egalpos}[#6] + \@egdrawnode{#1}% +} + +% 4 arguments at end +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label 3 +% #5: action label position +% #6: payoffs +% #7: payoffs +% #8: payoffs +\def\@iiibtxz#1#2#3#4#5#6#7[#8]{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#4}{#5}[#8] + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}{#5}[#6] + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#3}{#5}[#7] + \@egdrawnode{#1}% +} + +% 1 argument at end, so must be egalpos +% #1: player label +% #2: action label 1 +% #3: action label 2 +% #4: action label 3 +% #5: action label position +\def\@iiibtnx#1#2#3#4#5{% + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxnum,\@egyynum){#4}{#5} + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum){#2}{#5} + \@egdrawbranch(\@egxnum,\@egynum)(\@egxxxxnum,\@egyyyynum){#3}{#5} + \@egdrawnode{#1}% +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% CONTINUUM OF BRANCHES +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% continuum of branches + +% reset \@eghnum and \@egvnum, and for u and d directions, reset \@eghdistance +\def\@egctmsethv#1#2{% + \if\@egdirection d + \multiply\@eghdistance by\@egabsvnum + \divide\@eghdistance by\@egabshnum + \else\if\@egdirection u + \multiply\@eghdistance by\@egabsvnum + \divide\@eghdistance by\@egabshnum + \fi\fi + \@eghnum=#1\@egvnum=#2 + \ifnum\@eghnum<0 + \@egabshnum=-\@eghnum + \else\@egabshnum=\@eghnum\fi + \ifnum\@egvnum<0 + \@egabsvnum=-\@egvnum + \else\@egabsvnum=\@egvnum\fi + \if\@egdirection d + \ifnum\@eghnum=0 + \else + \multiply\@eghdistance by\@egabshnum + \divide\@eghdistance by\@egabsvnum + \fi + \else\if\@egdirection u + \multiply\@eghdistance by\@egabshnum + \divide\@eghdistance by\@egabsvnum + \fi\fi% +} + +% Draw shaded triangle (using parameters from \putbranch) +\def\ctmb{% + \@egxyiicalc + \psline[linestyle=none,fillstyle=solid,fillcolor=\ctmfillcolor]% + (\@egxnum,\@egynum)(\@egxxnum,\@egyynum)(\@egxxxnum,\@egyyynum)% + \@ifnextchar[{\@ctmbpsto}{\@ctmbpstno} +} + +\def\ctmbarc{% + \@egxyiicalc + \psline(\@egxnum,\@egynum)(\@egxxnum,\@egyynum)% + \psline(\@egxnum,\@egynum)(\@egxxxnum,\@egyyynum)% + \@tempcntx=\@egxnum% + \advance\@tempcntx by-\@egxxnum% + \divide\@tempcntx by2 + \@tempcnty=\@egynum% + \advance\@tempcnty by-\@egyynum% + \divide\@tempcnty by2 + \@egxdim=\@tempcntx\psxunit% + \@egydim=\@tempcnty\psyunit% +% see pst-3d.tex for \pst@pyth and pstricks.tex for its use + \pst@pyth\@egxdim\@egydim\@egrad% + \psclip% + {\psline[linestyle=none](\@egxnum,\@egynum)(\@egxxnum,\@egyynum)% + (\@egxxxnum,\@egyyynum)} + \pscircle[linestyle=\egarclinestyle,linewidth=\egarclinewidth,% + linecolor=\egarclinecolor](\@egxnum,\@egynum){\@egrad} + \endpsclip + \@ifnextchar[{\@ctmbpsto}{\@ctmbpstno} +} + +% first argument is option +% +% #1: list of options +% #2: player name +\def\@ctmbpsto[#1]#2{% + \@ifnextchar[{\@ctmbo{#1}{#2}}{\@ctmb{#1}{#2}}% +} + +% #1 is option list +% #2 is player name +% #3 is player label position +% (#4,#5) is direction of single branch +% #6 is action label +\def\@ctmbo#1#2[#3](#4,#5)#6{% + \@egctmsethv{#4}{#5} + \@ifnextchar[{\@ctmbot{#1}{#2}{#3}{#6}}{\@ctmbotn{#1}{#2}{#3}{#6}}% +} + +% #1 is option list +% #2 is player name +% (#3,#4) direction of branch +% #5 is action label +\def\@ctmb#1#2(#3,#4)#5{% + \@egctmsethv{#3}{#4} + \@ifnextchar[{\@ctmbot{#1}{#2}{t}{#5}}{\@ctmbotn{#1}{#2}{t}{#5}}% +} + +% #1: option list +% #2: player name +% #3: player label position +% #4: action label +% #5: action label position OR payoff +\def\@ctmbot#1#2#3#4[#5]{% + \@ifnextchar[{\@ctmbt{#1}{#2}{#3}{#4}{#5}}{\@ctmbtn{#1}{#2}{#3}% +{#4}{#5}}% +} + +% #1: option list +% #2: player name +% #3: player label position +% #4: action label +% #5: action label position +% #6: payoff +\def\@ctmbt#1#2#3#4#5[#6]{ +% need to recalculate \@eghdistance for u and d directions + \ib[#1]{#2}[#3]{#4}[#5][#6] +} + +% #1: option list +% #2: player name +% #3: player label position +% #4: action label +% #5: action label position OR payoff +\def\@ctmbtn#1#2#3#4#5{ + \ib[#1]{#2}[#3]{#4}[#5] +} + +% #1: option list +% #2: player name +% #3: player label position +% #4: action label +\def\@ctmbotn#1#2#3#4{% + \ib[#1]{#2}[#3]{#4} +} + +% first argument is not option +% +% #1: player name +\def\@ctmbpstno#1{% + \@ifnextchar[{\@ctmbox{#1}}{\@ctmbx{#1}}% +} + +% #1: player name +% #2: player label position +% (#3,#4): direction of branch +% #5: action label +\def\@ctmbox#1[#2](#3,#4)#5{% + \@egctmsethv{#3}{#4} + \@ifnextchar[{\@ctmbotx{#1}{#2}{#5}}{\@ctmbotnx{#1}{#2}{#5}}% +} + +% #1: player name +% (#2,#3): direction of branch +% #4: action label +\def\@ctmbx#1(#2,#3)#4{% + \@egctmsethv{#2}{#3} + \@ifnextchar[{\@ctmbotx{#1}{t}{#4}}{\@ctmbotnx{#1}{t}{#4}}% +} + +% #1: player name +% #2: player label position +% #3: action label +% #4: action label position +\def\@ctmbotx#1#2#3[#4]{% + \@ifnextchar[{\@ctmbtx{#1}{#2}{#3}{#4}}{\@ctmbtnx{#1}{#2}{#3}{#4}}% +} + +% #1: player name +% #2: player label position +% #3: action label +\def\@ctmbotnx#1#2#3{% + \ib{#1}[#2]{#3} +} + +% #1: player name +% #2: player label position +% #3: action label +% #4: action label position +% #5: payoffs +\def\@ctmbtx#1#2#3#4[#5]{% + \ib{#1}[#2]{#3}[#4][#5] +} + +% #1: player name +% #2: player label position +% #3: action label +% #4: payoffs +\def\@ctmbtnx#1#2#3#4{% + \ib{#1}[#2]{#3}[#4] +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%% INFORMATION SETS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Information set +% \infoset(x,y)[direction]{length}{name of player}[player label position] +% +\def\infoset(#1,#2){% + \def\@egdirection{\@egdefdirection} % in case reset by earlier \putbranch + \@ifnextchar[{\@infoseto(#1,#2)}{\@infoset(#1,#2)}% +} + +\def\@infoseto(#1,#2)[#3]#4#5{% + \def\@infosetdir{#3}% + \@ifnextchar[{\@infos(#1,#2){#4}{#5}}{\@infosn(#1,#2){#4}{#5}}% +} + +\def\@infoset(#1,#2)#3#4{% + \if\@egdirection d + \def\@infosetdir{h}% + \else\if\@egdirection u + \def\@infosetdir{h}% + \else\if\@egdirection r + \def\@infosetdir{v}% + \else\if\@egdirection l + \def\@infosetdir{v}% + \fi\fi\fi\fi + \@ifnextchar[{\@infos(#1,#2){#3}{#4}}{\@infosn(#1,#2){#3}{#4}}% +} + +\def\@infos(#1,#2)#3#4[#5]{% + \def\@branchplp{#5} + \@infosetx(#1,#2){#3}{#4}% +} + +\def\@infosn(#1,#2)#3#4{% + \if\@egdirection d + \if\@infosetdir h + \def\@branchplp{u} + \else + \def\@branchplp{r} + \fi + \else\if\@egdirection u + \if\@infosetdir h + \def\@branchplp{d} + \else + \def\@branchplp{r} + \fi + \else\if\@egdirection r + \if\@infosetdir v + \def\@branchplp{l} + \else + \def\@branchplp{u} + \fi + \else\if\@egdirection l + \if\@infosetdir v + \def\@branchplp{r} + \else + \def\@branchplp{u} + \fi + \fi\fi\fi\fi + \@infosetx(#1,#2){#3}{#4}% +} + +\def\@infosetx(#1,#2)#3#4{% + \fboxrule 0pt\fboxsep\egplayerlabelsep + \@egxnum=#1\@egxxnum=#1\@egynum=#2\@egyynum=#2\@eghnum=#3\@egvnum=#3 + \divide\@egvnum by\infosetdotsep% space between dots (not a vnum at all) + \advance\@egvnum by-1% because won't put dots at nodes + \if\@infosetdir h +% \multips doesn't start at right point + \advance\@egxxnum by\infosetdotsep% put first dot @ next pt after node + \multiput(\@egxxnum,\@egynum)(\infosetdotsep,0){\@egvnum}{\infosetdot} + \else\if\@infosetdir v% + \advance\@egyynum by\infosetdotsep + \multiput(\@egxnum,\@egyynum)(0,\infosetdotsep){\@egvnum}{\infosetdot} + \fi\fi +% \psline doesn't allow control of dot style, it seems +% \psline[linestyle=dotted](\@egxnum,\@egynum)(\@egxxnum,\@egyynum) + \psset{framesep=\egplayerboxsep} + \fboxrule 0pt\fboxsep\egplayerlabelsep + \divide\@eghnum by2 + \if\@infosetdir h + \advance\@egxnum by\@eghnum + \if\@branchplp o + \rput*(\@egxnum,\@egynum){\fbox{\@egplbox{#4}}} + \else\if\@branchplp u + \rput[b](\@egxnum,\@egynum){\fbox{\@egplbox{#4}}} + \else\if\@branchplp d + \rput[t](\@egxnum,\@egynum){\fbox{\@egplbox{#4}}} + \fi\fi\fi + \else\if\@infosetdir v + \advance\@egynum by\@eghnum + \if\@branchplp o + \rput*(\@egxnum,\@egynum){\fbox{\@egplbox{#4}}} + \else\if\@branchplp l + \rput[r](\@egxnum,\@egynum){\fbox{\@egplbox{#4}}} + \else\if\@branchplp r + \rput[l](\@egxnum,\@egynum){\fbox{\@egplbox{#4}}} + \fi\fi\fi + \fi\fi +} + +%%%%%%%%%%%%%%%%%%%%%% +% egame environment +%%%%%%%%%%%%%%%%%%%%%% + +\def\egame(#1,#2){% + \initialtrue + \@ifnextchar[{\@egulo(#1,#2)}{\@egul(#1,#2)}% +} + +% set unit length for game + +\def\@egulo(#1,#2)[#3]{% + \psset{unit=#3} + \begin{pspicture}(#1,#2) +} + +\def\@egul(#1,#2){% + \psset{unit=0.1mm} + \begin{pspicture}(#1,#2) +} + +\def\endegame{\end{pspicture}} + diff --git a/macros/latex/contrib/egameps/egameps.tex b/macros/latex/contrib/egameps/egameps.tex new file mode 100644 index 0000000000..20c902f954 --- /dev/null +++ b/macros/latex/contrib/egameps/egameps.tex @@ -0,0 +1,1549 @@ +% +% Changes relative to egame.sty: +% 1. No anomalous cases for \iib +%2. eginfods changed to eginfodotsep +%3. No small disks at ends of histories +% +%Allows any slope for branches, and any style. +% +\documentclass[12pt]{article} +\usepackage{mjoarti} +\usepackage{pstricks} +\usepackage{pstcol,pst-mjo,pst-3d} +\usepackage{url} +\usepackage{egameps} +\begin{document} + +\renewcommand{\descriptionlabel}[1]{\hspace\labelsep + \normalfont #1\phantom{.}} + +\begin{center} +{\bfseries Manual for {\tt egameps.sty}}\\ +by\\ +Martin J. Osborne\\ +{\tt martin.osborne@utoronto.ca}\\ +Version 1.1, June 2004\\ +(based on \texttt{egame.sty}, November 1997) +\end{center} + + +\section{Introduction} +{\tt egameps.sty} is a \LaTeX2e\ style file for drawing extensive games. It +is intended to have the capability of drawing any extensive game. It is not +very fast (probably because it is not written very efficiently, but possibly +simply because it needs to make a lot of computations). The latest version is +available at \url{http://www.economics.utoronto.ca/osborne/latex/}. + +The style requires the PSTricks package (available on CTAN; documented in +\emph{The \LaTeX\ Graphics Companion}) and a means of printing a Postscript +file (e.g.\ a Postscript printer, or a non-Postscript printer and the program +Ghostscript). Because the style uses the PSTricks macros, it is incompatible +with \verb+pdftex+. You may produce a pdf file by first creating a dvi file +normally, then using \verb+dvips+ to create a Postscript file, and finally +using Ghostscript to create a pdf file from the Postscript file. (If your +operating system is DOS or Windows, you can automate this process in a batch +file. If your text editor is sufficiently configurable, you will be able to +initiate the process with a single keystroke.) Alternatively, you use the +\verb+pdftricks+ package to finesse the limitation of \verb+pdftex+; see +Section~\ref{s:pdftricks}. +\section{Installation} +\begin{itemize} + \item Put \texttt{egameps.sty} in a directory from which \TeX\ reads input +files. (In MiKTeX the directory might be something like +\url{\miktex\localtexmf\tex\latex\} or a subdirectory thereof.) + \item Let \TeX\ know that \texttt{egameps} has arrived. (In MiKTeX, +``refresh the filename database''.) + \item Check that you have PSTricks. If you do not, get it from CTAN. + \item To use the package in a document, put the lines\newline +\indent\verb+\usepackage{pstricks}+\newline +\indent\verb+\usepackage{pstcol}+\newline +\indent\verb+\usepackage{egameps}+\newline +in the preamble. To use the macro \verb+\ctmbarc+ you need to include also +the line\newline +\indent\verb+\usepackage{pst-3d}+ +\end{itemize} +\section{Using the style} +To draw a game using the style, first break the game into components, each +consisting of a node together with the branches that emanate from it, the +names with which the actions are labeled, and the players' payoffs if the +nodes at the end of the branches are terminal. To draw each component, calls +to two macros are needed. First \verb+\putbranch+ is called, which sets the +position of the node and the slope and length of the branch(es), then either +\verb+\ib+, \verb+\iib+, or \verb+\iiib+. The macro \verb+\ib+ draws a single +branch, while \verb+\iib+ and \verb+\iiib+ draw two and three branches +respectively. If the node has more than three branches, calls to a +combination of these macros are needed. + +A game is begun by a call of the type\newline +\indent\verb+\begin{egame}400,500)+\newline +which starts a \verb+pspicture+, with dimensions $(400,500)$ and the +unitlength equal to the default of 0.1mm, or\newline +\indent\verb+\begin{egame}(400,500)[1mm]+\newline +which starts a \verb+pspicture+, with dimensions $(400,500)$ and sets the +unitlength at 1mm. + +The next section gives examples that illustrate many of the features of the +package. Precise descriptions of the macros are given in +Section~\ref{s:descr}. +\section{Examples} +The game in Figure~\ref{f:one} is produced by the following code. + +%%%%%%%%%%%%%% +%% EXAMPLE 1 % +%%%%%%%%%%%%%% +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(600,280) +% +% put the initial branch at (300,240), with (x,y) direction +% (2,1), and horizontal length 200 +\putbranch(300,240)(2,1){200} +% +% give the branch two actions, label it for player 1, +% and label the actions $L$ and $R$ +\iib{1}{$L$}{$R$} +% +% put a branch at (100,140), with (x,y) direction +% (1,1) and horizontal length 100 +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and assign the payoffs +% $1,0$ and $2,3$ to these actions +\iib{}{$a$}{$b$}[$1,0$][$2,3$] +% +% put a branch at (500,140), with (x,y) direction (1,1) +% and horizontal length 100 +\putbranch(500,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $c$ and $d$, and assign the payoffs +% $0,1$ and $-1,0$ to these actions +\iib{}{$c$}{$d$}[$0,1$][$-1,0$] +% +% draw an information set between the nodes at (100,140) +% and (500,140) +\infoset(100,140){400}{2} +% +\end{egame} +\hspace*{\fill} +\caption[]{An extensive game}\label{f:one} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(600,280) +\putbranch(300,240)(2,1){200} +\iib{1}{$L$}{$R$} +\putbranch(100,140)(1,1){100} +\iib{}{$a$}{$b$}[$1,0$][$2,3$] +\putbranch(500,140)(1,1){100} +\iib{}{$c$}{$d$}[$0,1$][$-1,0$] +\infoset(100,140){400}{2} +\end{egame} +\hspace*{\fill} +\caption[]{An extensive game}\label{f:one} +\end{figure} + +Another example, illustrating more features, is produced by the following +code, and is shown in Figure~\ref{f:two}. + +%%%%%%%%%%%%%% +%% EXAMPLE 2 % +%%%%%%%%%%%%%% + +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +% +% fill boxes containing payoffs with a solid red color +\renewcommand{\egpayboxfillstyle}{solid} +\renewcommand{\egpayboxfillcolor}{red} +% add a bit of separation around the payoffs +\egpayoffboxsep=1mm +% +% fill boxes containing action labels with a solid blue color +\renewcommand{\egalboxfillstyle}{solid} +\renewcommand{\egalboxfillcolor}{blue} +\egactionboxsep=1mm +% +% put player labels in green circles +\renewcommand{\egplbox}{c} +\renewcommand{\egplboxlinestyle}{solid} +\renewcommand{\egplboxlinecolor}{green} +\egplayerboxsep=1mm +% +\begin{egame}(500,280) +% +% put the initial branch at (300,240), with (x,y) direction +% (2,1), and horizontal length 200 +\putbranch(300,240)(2,1){200} +% +% give the branch three actions, label it for player 1, +% label the actions $L$, $M$, and $R$, and make the middle +% and right actions terminal, with payoffs $1,2$ and $0,1$ +\iiib{1}{$L$}{$M$}{$R$}[][$1,2$][$0,1$] +% +% put a branch at (100,140), with (x,y) direction +% (1,1) and horizontal length 100 +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, make the left-hand one dashed, +% label the branch for player 2, putting +% the player label to the top left of the node, +% label the actions $a$ and $b$, and assign the payoffs +% $1,0$ and $2,3$ to these actions +\iib[linestyle=dashed][]{2}[l]{$a$}{$b$}[$1,0$][$2,3$] +% +\end{egame} +\hspace*{\fill} +\caption[]{Another extensive game}\label{f:two} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\renewcommand{\egpayboxfillstyle}{solid} +\renewcommand{\egpayboxfillcolor}{red} +\egpayoffboxsep=1mm +\renewcommand{\egalboxfillstyle}{solid} +\renewcommand{\egalboxfillcolor}{blue} +\egactionboxsep=1mm +\renewcommand{\egplbox}{c} +\renewcommand{\egplboxlinestyle}{solid} +\renewcommand{\egplboxlinecolor}{green} +\egplayerboxsep=1mm +\begin{egame}(500,280) +% +% put the initial branch at (300,240), with (x,y) direction +% (2,1), and horizontal length 200 +\putbranch(300,240)(2,1){200} +% +% give the branch three actions, label it for player 1, +% label the actions $L$, $M$, and $R$, and make the middle +% and right actions terminal, with payoffs $1,2$ and $0,1$ +\iiib{1}{$L$}{$M$}{$R$}[][$1,2$][$0,1$] +% +% put a branch at (100,140), with (x,y) direction +% (1,1) and horizontal length 100 +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, label it for player 2, putting +% the player label to the top left of the node, +% label the actions $a$ and $b$, and assign the payoffs +% $1,0$ and $2,3$ to these actions +\iib[linestyle=dashed][]{2}[l]{$a$}{$b$}[$1,0$][$2,3$] +% +\end{egame} +\hspace*{\fill} +\caption[]{Another extensive game}\label{f:two} +\end{figure} + +Yet another example, illustrating still more features, is produced by the +following code, and is shown in Figure~\ref{f:three}. + +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +% +\begin{egame}(600,480) +% +% put the initial branch at (300,240), with (x,y) direction +% (1,0), and horizontal length 200 +\putbranch(300,240)(1,0){200} +% +% give the branch two actions, label it for player $c$, +% and label the actions ${1\over 2}$ and ${1\over 2}$ +\iib{$c$}{${1\over 2}$}{${1\over 2}$} +% +% put a branch at (100,240), with (x,y) direction +% (0,1), going right, and vertical length 100. (Notes: If the +% branch were specified as going left, it would look the same, +% but the player label would be in the wrong place. The +% third mandatory argument of \putbranch is the horizontal +% distance unless the branch is vertical, in which case it is +% the vertical distance.) +\putbranch(100,240)(0,1)[r]{100} +% +% give the branch two actions, label it for player 1, +% and label the actions $a$ and $b$ +\iib{1}{$a$}{$b$} +% +% put a branch at (500,240), with (x,y) direction +% (0,1), going left, and vertical length 100. +\putbranch(500,240)(0,1)[l]{100} +% +% give the branch two actions, label it for player 1, +% and label the actions $b$ and $a$ +\iib{1}{$b$}{$a$} +% +% put an information set at (100,340), of length 400, +% assigned to player 2 +\infoset(100,340){400}{2} +% +% put an information set at (100,140), of length 400, +% assigned to player 2 +\infoset(100,140){400}{2} +% +% put a branch at (100,340), with (x,y) direction +% (1,1), going up, and horizontal length 100. +\putbranch(100,340)(1,1)[u]{100} +% +% specify a positive horizontal shift for the action labels, +% which slides the ones on the right-hand branches to the +% right along the branches and the ones on the left to the +% left, improving the label positions +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $-1,0$ and $0,-1$. +\iib{}{$L$}{$R$}[$-1,0$][$0,-1$] +% +% put a branch at (500,340), with (x,y) direction +% (1,1), going up, and horizontal length 100. +\putbranch(500,340)(1,1)[u]{100} +% +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $1,0$ and $0,1$. +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +% +% put a branch at (100,140), with (x,y) direction +% (1,1), going down, and horizontal length 100. +\putbranch(100,140)(1,1)[d]{100} +% +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $2,0$ and $0,2$. +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +% +% put a branch at (500,140), with (x,y) direction +% (1,1), going down, and horizontal length 100. +\putbranch(500,140)(1,1)[d]{100} +% +\egalhshift=20 +% +% give the branch two actions, give it no player label, +% label the actions $L$ and $R$, and put payoffs of +% $3,0$ and $0,3$. +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +% +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:three} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\egpayoffboxsep=0mm +\begin{egame}(600,480) +\putbranch(300,240)(1,0){200} +\iib{$c$}{${1\over 2}$}{${1\over 2}$} +\putbranch(100,240)(0,1)[r]{100} +\iib{1}{$a$}{$b$} +\putbranch(500,240)(0,1)[l]{100} +\iib{1}{$b$}{$a$} +\infoset(100,340){400}{2} +\infoset(100,140){400}{2} +\putbranch(100,340)(1,1)[u]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$-1,0$][$0,-1$] +\putbranch(500,340)(1,1)[u]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$1,0$][$0,1$] +\putbranch(100,140)(1,1)[d]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$2,0$][$0,2$] +\putbranch(500,140)(1,1)[d]{100} +\egalhshift=20 +\iib{}{$L$}{$R$}[$3,0$][$0,3$] +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:three} +\end{figure} + +The next example, shown in Figure~\ref{f:four}, shows how to combine calls to +\verb+\iib+ to draw nodes followed by four branches. + +\begin{verbatim} +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(1200,380) +% +% put an initial node at (700,340), with (x,y) direction +% (3,1), and horizontal length 600 +\putbranch(700,340)(3,1){600} +% +% give the branch two actions, label it for player $1$, +% label the actions $A$ and $D$, and make the right- +% hand node terminal, with payoffs $0,1$. +\iib[linecolor=red][]{$1$}{$A$}{$D$}[][$0,1$] +% +% to add two more branches to the initial node, force +% the branch to be initial +\initialtrue +% and specify the direction (1,1) and the horizontal length 200 +\putbranch(700,340)(1,1){200} +% +% tighten the spacing between labels and branches, to improve +% appearance (given the other branches) +\egactionlabelsep=0.5mm +% give the branch two actions and label the actions $B$ and $C$ +\iib{}{$B$}{$C$} +% +% reset default spacing +\egactionlabelsep=1mm +% put a branch at (100,140), with direction (1,1) +% and horizontal length 100. +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$2,1$][$4,0$] +% +% put a branch at (500,140), with direction (1,1) +% and horizontal length 100. +\putbranch(500,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$1,3$][$-1,0$] +% +% put a branch at (900,140), with direction (1,1) +% and horizontal length 100. +\putbranch(900,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$-1,0$][$2,1$] +% +% put an information set at (100,140), of length 800, +% assigned to player 2 +\infoset(100,140){800}{2} +% +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:four} +\end{figure} +\end{verbatim} + +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(1300,380) +% +% put an initial node at (700,340), with (x,y) direction +% (6,1), and horizontal length 600 +\putbranch(700,340)(3,1){600} +% +% give the branch two actions, label it for player $1$, +% and label the actions $A$ and $D$, and make the right- +% hand node terminal, with payoffs $0,1$. +\iib[linecolor=red][]{$1$}{$A$}{$D$}[][$0,1$] +% +% to add two more branches to the initial node, force +% the branch to be initial +\initialtrue +% and specify the direction (2,1) and the horizontal length 200 +\putbranch(700,340)(1,1){200} +% +% tighten the spacing between labels and branches, to improve +% appearance (given the other branches) +\egactionlabelsep=0.2mm +% give the branch two actions and label the actions $B$ and $C$ +\iib{}{$B$}{$C$} +% +% reset default spacing +\egactionlabelsep=0.7mm +% put a branch at (100,140), with direction (1,1) +% and horizontal length 100. +\putbranch(100,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$2,1$][$4,0$] +% +% put a branch at (500,140), with direction (1,1) +% and horizontal length 100. +\putbranch(500,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$1,3$][$-1,0$] +% +% put a branch at (900,140), with direction (1,1) +% and horizontal length 100. +\putbranch(900,140)(1,1){100} +% +% give the branch two actions, omit a player label, +% label the actions $a$ and $b$, and put payoffs +\iib[][linecolor=red]{}{$a$}{$b$}[$-1,0$][$2,1$] +% +% put an information set at (100,140), of length 800, +% assigned to player 2 +\infoset(100,140){800}{2} +% +\end{egame} +\hspace*{\fill} +\caption[]{Yet another extensive game}\label{f:four} +\end{figure} + + +\section{Description of macros\label{s:descr}} +\verb+\begin{egame}(+\emph{width}\verb+,+\emph{height}% +{\tt )[}\emph{unitlength}\verb+]+\newline +\noindent begins an extensive game of width \emph{width} and height +\emph{height} and optionally sets the unitlength to be \emph{unitlength} +(default 0.1mm). In the game, all distances are given as integers, which are +interpreted as multiples of the unitlength. These integers should (probably) +be divisible by two, so that the integer arithmetic employed by \TeX\ doesn't +lose accuracy when numbers are divided by two. I have tested the macros +thoroughly only with the default unitlength of 0.1mm; unless there is a +compelling reason to use some different unitlength, I suggest sticking to +0.1mm. (\verb+\begin{egame}(w,h)+ starts a \verb+pspicture+ environment +(defined by PSTricks) of width {\tt w} and height {\tt h}.) + +Permissible values: +\begin{description} +\item[\emph{width}, \emph{height}] Any pair of integers. (You need to +calculate these numbers.) +\item[\emph{unitlength}] Any dimension. Default: 0.1mm. +\end{description} + +\vspace{4mm} + +\noindent\verb+\end{egame}+\newline +\noindent ends an extensive game. + +\vspace{4mm} + +\noindent\verb+\putbranch(+\emph{x-coord}\verb+,+\emph{y-coord}{\tt +)(}\emph{h-incr},\emph{v-incr}{\tt +)[}\emph{direction}\verb+]{+\emph{length}\verb+}+\newline +\noindent sets up the parameters for a branch at the point +$($\emph{x-coord}$,$\emph{y-coord}$)$, with direction parameter +$($\emph{h-incr}$,$\emph{v-incr}$)$, optional direction \emph{direction}, and +length \emph{length}. Note that this macro merely sets up the parameters for +a call to \verb+\ib+ (one branch), \verb+\iib+ (two branches), \verb+\iiib+ +(three branches), or \verb+\ctmb+ (continuum of branches); it does not draw +anything. The way in which the direction parameter +$($\emph{h-incr}$,$\emph{v-incr}$)$ is interpreted depends on whether +\verb+\ib+, \verb+\iib+, or \verb+\iiib+ is used to draw the branches. The +\emph{length} is the horizontal distance between the ends of one of the +branches to be drawn, unless \emph{h-incr} is 0, in which case \emph{length} +is the vertical distance between the ends of one of the branches. + +Permissible values: +\begin{description} +\item[$($\emph{x-coord}$,$\emph{y-coord}$)$] Any pair of integers. +\item[$($\emph{h-incr}$,$\emph{v-incr}$)$] Any pair of integers except +\verb+(0,0)+. +\item[\emph{direction}] {\tt d} (down), {\tt u} (up), {\tt r} (right), or {\tt +l} (left); default {\tt d}. (The direction can be changed also globally, by +specifying \verb+\egdirection{+\emph{direction}\verb+}+ before the call to +\verb+\putbranch+.) +\item[\emph{length}] Any positive integer. +\end{description} + +\vspace{4mm} + +\noindent\verb+\ib[+\emph{branchstyle}\verb+]{+\emph{player-name}\verb+}[+% +\emph{player-label-position}\verb+]{+\emph{action-label}\verb+}+\newline +\verb+[+\emph{action-label-position}\verb+][+\emph{payoffs}{\tt ]}\newline +\noindent puts a single branch with the parameters of the preceding call to +\verb+\putbranch+, optionally using the PSTricks style \emph{branchstyle}, +assigns it the player name \emph{player-name}, optionally positions the player +label relative to the node according to \emph{player-label-position}, labels +the action \emph{action-label}, optionally positions the label according to +\emph{player-label-position}, and optionally adds the payoffs \emph{payoffs}. +A single optional argument at the end is interpreted as follows: if its value +is \verb+o+ (outside), \verb+i+ (inside), or \verb+c+ (centered), it +determines the position of the action label; otherwise, it is a payoff label. +If there are two optional arguments, the first must be \verb+o+ (outside), +\verb+i+ (inside), or \verb+c+ (centered), determining the position of the +action label, and the second is a payoff label. (If you do not want an +optional positioning argument and you want your payoff label to be ``o'', +``i'', or ``c'', here's a workaround: put the label in an \verb+hbox+, as in +\verb+\hbox{o}+. (Note that you do not need to do this if your payoff label +is \verb+$o$+, etc.---only if it is just ``o''.) + +The first branch in any {\tt egame} is taken to be the initial branch of the +game; its beginning node is indicated by \verb+\eginode+, the default of which +is a small circle. Subsequent branches are taken to be noninitial, and are +indicated by \verb+\egnode+, the default value of which is a small disk. To +force a node to be initial, specify \verb+\initialtrue+ before it; to force a +node to be noninitial, specify \verb+\initialfalse+ before it. To change the +appearance of nodes, see Section~\ref{s:params}. + +Permissible values: +\begin{description} +\item[\emph{branchstyle}] Any PSTricks linestyle (e.g.\ \verb+linecolor=red+, +\verb+linestyle=dashed+, \verb+linewidth=2pt+, \verb+doubleline=true+). + +Default: \verb+linecolor=black+, \verb+linestyle=solid+, +\verb+linewidth=0.8pt+. +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[\emph{action-label}] Any character string. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered on branch). + +Default: \verb+o+. (For more on action label positioning, see +Section~\ref{s:alp}.) +\item[\emph{payoffs}] Any character string. +\end{description} + +Examples: +\begin{verbatim} +\putbranch(0,100)(2,-1){200} +\ib{1}{$x$} +\end{verbatim} +$$\begin{egame}(200,180) +\putbranch(0,140)(2,-1){200} +\ib{1}{$x$} +\psline{<->}(0,0)(200,0) +\rput*(100,0){200} +\end{egame}$$ + +Note that in the following example the \verb+1+ in the direction pair +\verb+(0,1)+ is interpreted as sending the branch down, given that the +\verb+\egdirection+ is \verb+d+. (That is, once you specify the +\verb+\egdirection+ (or leave it at the default \verb+d+) you do not need to +worry about getting the sign of the \emph{v-incr} correct (if the direction is +\verb+d+ or \verb+u+) or the sign of the \emph{h-incr} correct (if the +direction is \verb+l+ or \verb+r+). + +\begin{verbatim} +\putbranch(0,100)(0,1){100} +\ib[linecolor=gray]{1}[l]{$x$}[c] +\end{verbatim} +$$\begin{egame}(100,140) +\putbranch(0,100)(0,1){100} +\ib[linecolor=gray]{1}[l]{$x$}[c] +\psline{<->}(80,0)(80,100) +\rput*(80,50){100} +\end{egame}$$ + +\begin{verbatim} +\initialfalse +\putbranch(0,40)(1,1)[u]{100} +\ib{1}{$x$}[$0,2$] +\end{verbatim} +$$\begin{egame}(100,180) +\initialfalse +\putbranch(0,40)(1,1)[u]{100} +\ib{1}{$x$}[$0,2$] +\end{egame}$$ + +Notice that the optional direction specifier {\tt u} in \verb+\putbranch+ +affects not only the direction of the branch (which is determined by the +argument {\tt (1,1)}), but also the placement of the player label relative to +the starting node. + +\begin{verbatim} +\initialfalse +\putbranch(0,100)(1,1){100} +\ib{1}[l]{$x$}[i][$0,2$] +\end{verbatim} +$$\begin{egame}(100,180) +\putbranch(0,140)(1,-1){100} +\ib{1}[l]{$x$}[i][$0,2$] +\end{egame}$$ + +\vspace{4mm} + +\noindent\verb+\iib[+\emph{style1}\verb+][+\emph{style2}\verb+]{+\emph{player-% +name}\verb+}[+% +\emph{player-label-position}\verb+]{+\emph{action-label1}\verb+}+\newline +\verb+{+\emph{action-label2}\verb+}[+\emph{action-label-position}\verb+][+% +\emph{payoffs1}% +\verb+][+\emph{payoffs2}{\tt ]}\newline +\noindent puts two branches with the parameters of the preceding call to +\verb+\putbranch+, optionally using the PSTricks style \emph{branchstyle1} for +the left or upper branch and the style \emph{branchstyle2} for the other +branch (or \emph{branchstyle1} for both branches, if there is only one +optional argument), assigns it the player name \emph{player-name}, optionally +positions the player label relative to the node according to +\emph{player-label-position}, labels the left/upper action with +\emph{action-label1} and the right/lower action with \emph{action-label2}, +optionally using the position \emph{action-label-position}, and optionally +adds payoffs \emph{payoffs1} and \emph{payoffs2}. The signs of the direction +parameters $($\emph{h-incr}$,$\emph{v-incr}$)$ in the preceding +\verb+\putbranch+ call are ignored; the directions of the branches is +determined by the direction of the branch (as specified either by +\verb+\egdirection+ or by the optional argument of \verb+\putbranch+). If, +for example, the direction is {\tt d}, then one branch goes down and to the +left and the other goes down and to the right. + +The first branch in any {\tt egame} is taken to be the initial branch of the +game; its beginning node is indicated by \verb+\eginode+. Subsequent branches +are taken to be non-initial, and are indicated by \verb+\egnode+. To force a +node to be initial, specify \verb+\initialtrue+ before it; to force a node to +be noninitial, specify \verb+\initialfalse+ before it. + +Permissible values: +\begin{description} +\item[\emph{style1}, \emph{style2}] Any PSTricks line styles; see \verb+\ib+. +If there is only one style present, it is applied to both branches. If there +are two styles, the first is applied to the right hand branch and the second +to the left hand branch if the game direction is up or down, and the first is +applied to the lower branch and the second to the upper branch if the game +direction is left or right. +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[\emph{action-label1} and \emph{action-label2}] Any character strings. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered). Default: \verb+o+. +\item[\emph{payoffs1} and \emph{payoffs2}] Any character strings. +\end{description} + +Examples: + +Action labels ``outside'' (default): +\begin{verbatim} +\putbranch(100,140)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$} +\end{verbatim} +$$\begin{egame}(200,180) +\putbranch(100,140)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$} +\psline{<->}(100,0)(200,0) +\rput*(150,0){100} +\end{egame}$$ + +Action labels ``inside'': +\begin{verbatim} +\putbranch(100,140)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$}[i] +\end{verbatim} +$$\begin{egame}(200,140) +\putbranch(100,100)(1,1){100} +\iib[linestyle=dashed]{1}{$L$}{$R$}[i] +\end{egame}$$ + +Action labels ``centered'': +\begin{verbatim} +\renewcommand{\egarrowstyle}{e} +\putbranch(0,140)(2,1)[r]{200} +\iib{1}{$L$}{$R$}[c] +\end{verbatim} +$$\begin{egame}(100,280) +\renewcommand{\egarrowstyle}{e} +\putbranch(0,140)(2,1)[r]{200} +\iib{1}{$L$}{$R$}[c] +\psline{<->}(0,0)(200,0) +\rput*(100,0){200} +\end{egame}$$ + +\begin{verbatim} +\renewcommand{\egarrowstyle}{e} +\putbranch(0,100)(1,1)[r]{100} +\iib[linecolor=gray][doubleline=true]{1}{$L$}{$R$}[$1,2$][$0,-1$] +\end{verbatim} +$$\begin{egame}(100,250) +\renewcommand{\egarrowstyle}{e} +\putbranch(0,100)(1,1)[r]{100} +\iib[linecolor=gray][doubleline=true]{1}{$L$}{$R$}[c][$1,2$][$0,-1$] +\end{egame}$$ + +\begin{verbatim} +\renewcommand{\egarrowstyle}{m} +\psset{arrowscale=2} +\putbranch(200,40)(1,0)[d]{200} +\iib{1}{$L$}{$R$}[$1,2$][$0,-1$] +\end{verbatim} +$$\begin{egame}(400,80) +\renewcommand{\egarrowstyle}{m} +\psset{arrowscale=2} +\putbranch(200,40)(1,0)[d]{200} +\iib{1}{$L$}{$R$}[$1,2$][$0,-1$] +\end{egame}$$ + +\vspace{4mm} + +\psset{arrowscale=1} + +\noindent\verb+\iiib[+\emph{style1}\verb+]{+\emph{player-name}\verb+}[+\emph{p% +layer-label-position}% +\verb+]{+\emph{action-label1}\verb+}+\newline +\verb+{+\emph{action-label2}\verb+}{+\emph{action-label3}\verb+}[+\emph{action% +-label-position}\verb+][+% +\emph{payoffs1}\verb+][+\emph{payoffs2}\verb+]+\newline +\verb+[+\emph{payoffs3}{\tt ]}\newline +\noindent puts three branches with the parameters of the preceding call to +\verb+\putbranch+, optionally all in the PSTricks style \emph{style}, assigns +it the player name \emph{player-name}, optionally positions the player label +relative to the node according to \emph{player-label-position}, and labels the +left/top action with \emph{action-label1}, the middle action with +\emph{action-label3}, and the right/bottom action with \emph{action-label2}, +optionally positioning the labels according to \emph{action-label-position} +and putting the \emph{payoffs1}, \emph{payoffs2}, and \emph{payoffs3}. The +signs of the direction parameters $($\emph{h-incr}$,$\emph{v-incr}$)$ in the +preceding \verb+\putbranch+ call are ignored; the directions of the branches +are determined by the direction of the branch (as specified either by +\verb+\egdirection+ or by the optional argument of \verb+\putbranch+). If, +for example, the direction is {\tt d}, then one branch goes down and to the +left, one goes straight down, and one goes down and to the right. + +The first branch in any {\tt egame} is taken to be the initial branch of the +game; its beginning node is indicated by a small circle. Subsequent branches +are taken to be non-initial, and are indicated by \verb+\egnode+, the default +value of which is a small disk. To force a node to be initial, specify +\verb+\initialtrue+ before it; to force a node to be noninitial, specify +\verb+\initialfalse+ before it. + +Permissible values: +\begin{description} +\item[\emph{style}] Any PSTricks line style. [Note that only one style is +allowed, which applies to all three branches. If you want the branches to +have different styles, you need to use a combination of \verb+\ib+ and +\verb+\iib+.] +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[\emph{action-label1}, \emph{action-label2}, and \emph{action-label3}] +Any character strings. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered). Default: \verb+o+. +\item[\emph{payoffs1}, \emph{payoffs1}, and \emph{payoffs3}] Any character +strings. +\end{description} + +Examples: +\begin{verbatim} +\putbranch(200,240)(1,1){200} +\iiib{1}{$L$}{$M$}{$R$} +\end{verbatim} +$$\begin{egame}(400,280) +\putbranch(200,240)(1,1){200} +\iiib{1}{$L$}{$M$}{$R$} +\psline{<->}(200,0)(400,0) +\rput*(300,0){200} +\end{egame}$$ + +\begin{verbatim} +\putbranch(30,210)(1,1)[r]{200} +\iiib[linecolor=gray]{1}{$B$}{$M$}{$T$}[c][$1,2$][$0,-1$][$7,1$] +\end{verbatim} +$$\begin{egame}(340,460) +\putbranch(30,250)(1,1)[r]{200} +\iiib[linecolor=gray]{1}{$B$}{$M$}{$T$}[c][$1,2$][$0,-1$][$7,1$] +\psline{<->}(30,0)(230,0) +\rput*(130,0){200} +\end{egame}$$ + +\vspace{4mm} + +\noindent +\verb+\ctmb[+\emph{style}\verb+]{+\emph{player-name}\verb+}[+\emph{player-labe% +l-position}% +\verb+](+\emph{h-incr}\verb+,+\emph{v-incr}\verb+)+\newline +\verb+{+\emph{action-label}\verb+}[+\emph{action-label-position}\verb+][+\emph% +{payoffs}% +\verb+]+\newline +\noindent draws a continuum of branches starting with the parameters of the +previous call to \verb+\putbranch+, with a single branch drawn as a line with +PSTricks style \emph{style}, player \emph{player}, with the label optionally +positioned according to \emph{player-label-position}, and slope +\emph{h-incr,v-incr}, labeled with \emph{action-label}, which is optionally +positioned according to \emph{action-label-position}, and optionally with +payoffs \emph{payoffs}. + +\sloppy +The color of the triangle representing the continuum of branches is +\verb+\ctmfillcolor+ (default \verb+verylightgray+ (defined in the style)). + + +\fussy +Permissible values: +\begin{description} +\item[\emph{style}] Any PSTricks line style. [Note that this is the style of +the single branch, {\bfseries not} of the triangle.] +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] Either \verb+o+ (centered over the node), +or +\begin{itemize} + \item If the direction of the branch (as specified either by +\verb+\egdirection+ or by an optional argument of \verb+\putbranch+) is {\tt +d} or {\tt u}, either {\tt l} (above/below and to the left) and {\tt r} +(above/below and to the right). + \item If the direction of the branch is {\tt r} or {\tt l}, either {\tt u} +(to the left/right and up) and {\tt d} (to the left/right and down). +\end{itemize} +Default: is to center the label above for \verb+\egdirection+=\verb+d+, below +for \verb+\egdirection+=\verb+u+, to the left of the node for +\verb+\egdirection+=\verb+r+, or to the right of the node for +\verb+\egdirection+=\verb+l+. +\item[$($\emph{h-incr}$,$\emph{v-incr}$)$] Any pair of integers. +\item[\emph{action-label}] Any character string. +\item[\emph{action-label-position}] \verb+o+ (outside), \verb+i+ (inside), or +\verb+c+ (centered). Default: \verb+o+. +\item[\emph{payoffs}] Any character strings. +\end{description} + +Examples: + +\begin{verbatim}\putbranch(50,240)(2,-1)[d]{200} +\ctmb{1}(0,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\ctmb{1}(0,1){$A$}[i][$2,2$] +\end{egame}$$ + +\begin{verbatim}\renewcommand{\ctmfillcolor}{red} +\renewcommand{\egarrowstyle}{e} +\putbranch(50,240)(2,-1)[d]{200} +\ctmb[linecolor=blue]{1}(-1,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,280) +\renewcommand{\ctmfillcolor}{red} +\renewcommand{\egarrowstyle}{e} +\putbranch(50,240)(2,-1)[d]{200} +\ctmb[linecolor=blue]{1}(-1,1){$A$}[i][$2,2$] +\end{egame}$$ + +\begin{verbatim}\putbranch(50,0)(2,1)[u]{200} +\ctmb{1}(1,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,180) +\putbranch(50,0)(2,1)[u]{200} +\ctmb{1}(1,1){$A$}[i][$2,2$] +\end{egame}$$ + +\vspace{4mm} + +\noindent +\verb+\ctmbarc[+\emph{style}\verb+]{+\emph{player-name}\verb+}[+\emph{player-l% +abel-position}% +\verb+](+\emph{h-incr}\verb+,+\emph{v-incr}\verb+)+\newline +\verb+{+\emph{action-label}\verb+}[+\emph{action-label-position}\verb+][+\emph% +{payoffs}% +\verb+]+\newline +\noindent represents a continuum of branches by an arc. The branches start +with the parameters of the previous call to \verb+\putbranch+, with a single +branch and the arc drawn using the PSTricks style \emph{style}, player +\emph{player}, the label optionally positioned according to +\emph{player-label-position}, the line with slope \emph{h-incr,v-incr}, +labeled with \emph{action-label} optionally positioned according to +\emph{action-label-position}, and optionally with payoffs \emph{payoffs}. + +\emph{This macro requires the package} \verb+pst-3d+ \emph{to be loaded after} +\verb+pstricks+\emph{. In the preamble to your document, include the line} +\verb+\include{pst-3d}+. (\verb+\pstricks+ itself includes the needed macro, +but its definition appears to differ from the one in \verb+pst-3d+, which is +the definition \verb+\ctmbarc+ needs.) + +The line drawn by the macro is the intersection of (\emph{i})~a circle +centered at the start of the branch with radius equal to a half of the +distance to the following node and (\emph{ii})~the triangle defined by the +starting node and the two following nodes. For some parameter values, this +line is not a full arc---see the last example. + +The options are the same as those for \verb+\ctmb+. The style of the arc is +controlled by the parameters \verb+\egarclinestyle+ (possible values +\verb+solid+, \verb+dashed+, \verb+dotted+, and \verb+none+; default +\verb+solid+), \verb+\egarclinewidth+ (any dimension; default \verb+0.6pt+), +\verb+\egarclinecolor+ (any color; default \verb+black+). + +Examples: + +\begin{verbatim}\putbranch(50,240)(2,2)[d]{200} +\ctmbarc{1}(1,-2){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,280) +\putbranch(50,240)(2,2)[d]{200} +\egalhshift=-12 +\ctmbarc{1}(1,-2){$A$}[i][$2,2$] +\end{egame}$$ + +\begin{verbatim}\def\egarclinestyle{dashed} +\def\egarclinewidth{2pt} +\def\egarclinecolor{blue} +\putbranch(0,150)(2,2)[r]{150} +\ctmbarc[linewidth=0.3pt,linecolor=red]{1}(1,0){$A$}[$2,2$]:\end{verbatim} +$$\begin{egame}(150,300) +\def\egarclinestyle{dashed}\def\egarclinewidth{2pt}\def\egarclinecolor{blue} +\putbranch(0,150)(2,2)[r]{150} +\ctmbarc[linewidth=0.3pt,linecolor=red]{1}(1,0){$A$}[$2,2$] +\end{egame}$$ + +In the next example part of the arc extends beyond the triangle defined by the +three nodes, and consequently does not appear. + +\begin{verbatim}\putbranch(50,0)(2,1)[u]{200} +\ctmbarc{1}(1,1){$A$}[i][$2,2$]:\end{verbatim} +$$\begin{egame}(100,180) +\putbranch(50,0)(2,1)[u]{200} +\ctmbarc{1}(1,1){$A$}[i][$2,2$] +\end{egame}$$ + +\vspace{4mm} + +\noindent\verb+\infoset(+\emph{x-coord}\verb+,+\emph{y-coord}% +\verb+)[+\emph{direction}\verb+]{+\emph{length}% +\verb+}{+\emph{player-name}\verb+}+\newline +\verb+[+\emph{player-label-position}\verb+]+\newline +\noindent draws an information set starting at +$($\emph{x-coord}$,$\emph{y-coord}$)$, optionally with direction +\emph{direction}, of length \emph{length}, with player label +\emph{player-name}. If the direction of the game is either down or up, the +information set is horizontal; if the direction of the game is either right or +left, the information set is vertical. The player label is positioned at the +middle of the information set, either above, below, to the left, or to the +right of it, depending on the direction of the game. (Its position can be +adjusted by adding some space before or after the player name. For +example,\newline \verb+\infoset(100,200){400}{1\hspace{10mm}}+\newline +centers the box containing \verb+1\hspace{10mm}+ relative to the information +set, thus moving the label by about 5mm. + +The dot character used in the information set is given by \verb+\infosetdot+, +the default value of which is \verb+\pscircle*{2.5}+; the spacing between the +dots is set by \verb+\infosetdotsep+, the default value of which is 20. (See +Section~\ref{s:params}.) + +Permissible values: +\begin{description} +\item[$($\emph{x-coord}$,$\emph{y-coord}$)$] Any pair of integers. +\item[\emph{direction}] {\tt h} (horizontal) or {\tt v} (vertical). If none +is specified, it is assumed to be \verb+h+ if the game direction is \verb+d+ +or \verb+u+, and \verb+v+ if the game direction is \verb+r+ or \verb+l+. +\item[\emph{length}] Any nonnegative integer. +\item[\emph{player-name}] Any character string. +\item[\emph{player-label-position}] \verb+o+ (over), \verb+u+ (up), or +\verb+d+ (down) if direction is \verb+h+, \verb+o+ (over), \verb+l+ (left), or +\verb+r+ (right) if direction is \verb+v+. +\end{description} + +Examples: +\begin{verbatim} +\egdirection{d} +\infoset(0,0){300}{1} +\end{verbatim} +$$\begin{egame}(300,4) +\egdirection{d} +\infoset(0,0){300}{1} +\end{egame}$$ + +\begin{verbatim} +\egdirection{d} +\infoset(0,0){300}{1}[o] +\end{verbatim} +$$\begin{egame}(300,4) +\egdirection{d} +\infoset(0,0){300}{1}[o] +\end{egame}$$ + +\begin{verbatim} +\egdirection{d} +\infoset(0,0)[u]{200}{1} +\end{verbatim} +$$\begin{egame}(0,200) +\egdirection{d} +\infoset(0,0)[v]{200}{1} +\end{egame}$$ + +\section{Positioning action labels}\label{s:alp} +The following algorithm is used to position an action label. The ``reference +point'' for a branch is its midpoint. An action label is surrounded by a box +(which may be colored and bordered by a line), from which it is separated by +\verb+\egactionboxsep+, then this box is surrounded by another box, from which +it is separated by \verb+\egactionlabelsep+. Then, for example, for a label +positioned above a downward-sloping branch, the bottom left-hand corner of the +outer box is placed at the reference point, as in Figure~\ref{f:al}. For a +label positioned above a horizontal branch, the bottom center of the outer box +is placed at the reference point. +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(400,200)[0.2mm] +\putbranch(0,200)(1,1){200} +\ib{}{} +\pspolygon[linewidth=0.4pt](100,100)(100,200)(200,200)(200,100) +\pspolygon[linewidth=0.4pt](120,120)(120,180)(180,180)(180,120) +\pspolygon[linewidth=0.4pt](145,145)(145,155)(155,155)(155,145) +\rput(150,150){o} +\psline{<->}(150,100)(150,120) +\rput[l](160,110){$x$} +\psline{<->}(150,120)(150,145) +\rput[l](160,132.5){$y$} +\rput[l](220,160){$y=\setminus $egactionboxsep} +\rput[l](220,130){$x=\setminus $egactionlabelsep} +\end{egame} +\hspace*{\fill} +\caption[]{The position of an action label above a downward-sloping +branch.}\label{f:al} +\end{figure} + +This algorithm is not perfect. (Note that it is not continuous in the slope +of the branch.) The positions of labels may need fine tuning, which may be +achieved by setting either \verb+\egalhshift+ or \verb+\egalvshift+ or both to +be nonzero (each is an integer, interpreted as a multiple of the unitlength). + +\verb+\egalhshift+ and \verb+\egalvshift+ must be set between +\verb+\putbranch+ and \verb+\ib+, \verb+\iib+, \verb+\iiib+, or \verb+\ctmb+. +(They are set to zero by \verb+\putbranch+.) + +If \verb+\egalhshift+ is nonzero and \verb+\egalvshift+ is not, the reference +point for the action label on the single branch in \verb+\ib+, of the +\emph{right-hand} branch for directions \verb+d+ and \verb+u+ and of both +branches for directions \verb+r+ and \verb+l+ in \verb+\iib+, and for the +outer branches of \verb+\iiib+, is moved horizontally by this amount and is +moved vertically to maintain the same separation from the branch. (That is, +the action label slides parallel to the branch; it moves horizontally by the +amount \verb+\egalhshift+.) The reference point of the label on the symmetric +branch is moved symmetrically. (Note that the label on the middle branch of +\verb+\iiib+ is not moved. If you want to move it, you need to write separate +calls to \verb+\iib+ and \verb+\ib+.) + +Similarly, if \verb+\egalvshift+ is nonzero and \verb+\egalhshift+ is not, the +reference point for the action label is moved vertically by this amount and is +moved horizontally to maintain the same separation from the branch. After a +branch is drawn, \verb+\egalhshift+ and \verb+\egalvshift+ are reset to zero. + +Note that the same effect can be acheived with either \verb+\egalhshift+ or +\verb+\egalvshift+. The two methods are provided simply because in some cases + a vertical shift might be more natural to specify, whereas in other cases a +horizontal shift might be more natural to specify. + +If \emph{both} \verb+\egalhshift+ and \verb+\egalvshift+ are nonzero, the +reference point is moved horizontally by \verb+\egalhshift+ and vertically by +\verb+\egalvshift+. + +Examples: + +\verb+\egdirection{d}+ +\verb+\egalhshift=40+ +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\egalhshift=40 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ + +\verb+\egalhshift=-40+ +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\egalhshift=-40 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ + +\verb+\egalhshift=40\egalvshift=40+ +$$\begin{egame}(100,280) +\putbranch(50,240)(2,-1)[d]{200} +\egalhshift=40\egalvshift=40 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ + +\verb+\egdirection{u}\egalhshift=60+ +$$\begin{egame}(100,280) +\putbranch(40,140)(2,-1)[r]{200} +\egalhshift=60 +\iib{1}{$A$}{$B$}[$1,1$][$2,2$] +\end{egame}$$ +\section{Arrows} +Branches can have arrows either at the end or in the middle, by setting + +\verb+\renewcommand{\egarrowstyle}{e}+ + +\noindent (for arrows at the end), or + +\verb+\renewcommand{\egarrowstyle}{m}+ + +\noindent (for arrows in the middle). The positioning of arrows in the middle +is not ideal: the \emph{tip} of the arrow is placed in the middle of the +branch, while ideally the \emph{middle} of the arrow should be there. I can't +see any easy way to improve the placement. + +The style of the arrows can be controlled with PSTricks' various parameters +(as described, for example, in the \LaTeX\ Graphics Companion). +\section{Parameters}\label{s:params} +\noindent\verb+\egdirection+\newline +\noindent Direction of game. Possible values: {\tt d} (down), {\tt u} (up), +{\tt r} (right), or {\tt l} (left). Default: {\tt d}. Example: +\verb+\egdirection{u}+. + +\vspace{4mm} + +\noindent\verb+\initialtrue+, \verb+\initialfalse+\newline +\noindent Force a node other than the first one in an \verb+egame+ to be +initial, or force the first node to be noninitial. + +\vspace{4mm} + +\sloppy +\noindent\verb+\eginode+\newline +\noindent Object used for initial node. Possible values: any object. +Default: \verb+\pscircle+ \verb+[linewidth=0.4pt]{5}+. Example: +\verb+\renewcommand{\eginode}+ \verb+{\makebox(0,0){\rule{0.5mm}{0.5mm}}}+ +(the \verb+\makebox+ causes the object to be positioned correctly). + +\fussy +\vspace{4mm} + +\noindent\verb+\egnode+\newline +\noindent Object used for nodes. Possible values: any object. Default: +\verb+\pscircle*{5}+. Example: +\verb+\renewcommand{\egnode}{\makebox(0,0){\rule{0.5mm}{0.5mm}}}+ (the +\verb+\makebox+ causes the object to be positioned correctly). + +\vspace{4mm} + +\sloppy +\noindent\verb+\infosetdot+\newline +\noindent Object used for ``dots'' in information sets. Possible values: any +object. Default: \verb+\pscircle*{2.5}+. Example: +\verb+\renewcommand{\infosetdot}+ \verb+{\pscircle*{5}}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\infosetdotsep+\newline +\noindent Spacing between dots in information set, as a multiple of the unit +length. Possible values: any positive integer. Default: 20. Example: +\verb+\renewcommand+ \verb+{\infosetdotsep}{40}+. + +\vspace{4mm} + +\noindent\verb+\egplayerlabelsep+\newline +\noindent Spacing used to position box containing player label relative to +center of initial node, and relative to center of information set. Possible +values: any dimension. Default: 1mm. Example: \verb+\egplayerlabelsep=2mm+. + +\vspace{4mm} + +\noindent\verb+\egplayerboxsep+\newline +\noindent Distance between edge of box around player label and player label. +Possible values: any dimension. Default: 0mm. Example: +\verb+\egplayerboxsep=1mm+. + +\vspace{4mm} + +\noindent\verb+\egactionlabelsep+\newline +\noindent Spacing used to position box containing action label relative to +branch. Possible values: any dimension. Default: 0.7mm. Example: +\verb+\egactionlabelsep=+ \verb+1mm+. + +\vspace{4mm} + +\noindent\verb+\egactionboxsep+\newline +\noindent Distance between edge of box around action label and action label. +Possible values: any dimension. Default: 0mm. Example: +\verb+\egactionboxsep=1mm+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egpayofflabelsep+\newline +\noindent Spacing used to position box containing action label relative to end +of branch. Possible values: any dimension. Default: 2mm. Example: +\verb+\egpayofflabelsep=1mm+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egpayoffboxsep+\newline +\noindent Distance between edge of box around payoffs and payoffs. Possible +values: any dimension. Default: 0mm. Example: \verb+\egpayoffboxsep=1mm+. + +\vspace{4mm} + +\noindent\verb+\egalpos+\newline +\noindent Position of action labels. Possible values: \verb+o+ (outside), +\verb+i+ (inside), \verb+c+ (center). Default: \verb+o+. Example: +\verb+\renewcommand{\egalpos}{c}+. + +\vspace{4mm} + +\noindent\verb+\egalbox+\newline +\noindent Type of box for action labels. Possible values: \verb+f+ (frame), +\verb+c+ (circle). Default: \verb+f+. Example: +\verb+\renewcommand{\egalbox}{c}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egalboxlinestyle+\newline +\noindent Style of lines around boxes containing action labels. Possible +values: \verb+none+, \verb+solid+, \verb+dashed+, \verb+dotted+. Default: +\verb+none+. Example: \verb+\renewcommand+ \verb+{\egalboxlinestyle}{solid}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egalboxlinecolor+\newline +\noindent Color of lines around boxes containing action labels. Possible +values: any defined color. Default: \verb+black+. Example: +\verb+\renewcommand{\egalboxlinecolor}+ \verb+{red}+. + +\vspace{4mm} + +\noindent\verb+\egalboxfillstyle+\newline +\noindent Style of fill of boxes containing action labels. Possible values: +\verb+none+, \verb+solid+, \verb+vlines+, \verb+vlines*+, \verb+hlines+, +\verb+hlines*+, \verb+crosshatch+, \verb+crosshatch*+. Default: \verb+none+. +Example: \verb+\renewcommand{\egalboxfillstyle}{solid}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egalboxfillcolor+\newline +\noindent Color of fill of boxes containing action labels. Possible values: +any defined color. Default: \verb+white+. Example: +\verb+\renewcommand{\egalboxfillcolor}+ \verb+{blue}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egpaybox+\newline +\noindent Type of box for payoffs. Possible values: \verb+f+ (frame), +\verb+c+ (circle). Default: \verb+f+. Example: +\verb+\renewcommand{\egpaybox}{c}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egpayboxlinestyle+\newline +\noindent Style of lines around boxes containing payoffs. Possible values: +\verb+none+, \verb+solid+, \verb+dashed+, \verb+dotted+. Default: +\verb+none+. Example: \verb+\renewcommand+ +\verb+{\egpayboxlinestyle}{solid}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egpayboxlinecolor+\newline +\noindent Color of lines around boxes containing payoffs. Possible values: +any defined color. Default: \verb+black+. Example: +\verb+\renewcommand{\egpayboxlinecolor}+ \verb+{gray}+. + +\vspace{4mm} + +\noindent\verb+\egpayboxfillstyle+\newline +\noindent Style of fill of boxes containing action payoffs. Possible values: +\verb+none+, \verb+solid+, \verb+vlines+, \verb+vlines*+, \verb+hlines+, +\verb+hlines*+, \verb+crosshatch+, \verb+crosshatch*+. Default: \verb+none+. +Example: \verb+\renewcommand{\egpayboxfillstyle}{solid}+. + +\vspace{4mm} + +\noindent\verb+\egpayboxfillcolor+\newline +\noindent Color of fill of boxes containing payoffs. Possible values: any +defined color. Default: \verb+white+. Example: +\verb+\renewcommand{\egpayboxfillcolor}{gray}+. + +\vspace{4mm} + +\noindent\verb+\egplbox+\newline +\noindent Type of box for player labels. Possible values: \verb+f+ (frame), +\verb+c+ (circle). Default: \verb+f+. Example: +\verb+\renewcommand{\egplbox}{c}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egplboxlinestyle+\newline +\noindent Style of lines around boxes containing player labels. Possible +values: \verb+none+, \verb+solid+, \verb+dashed+, \verb+dotted+. Default: +\verb+none+. Example: \verb+\renewcommand+ \verb+{\egplboxlinestyle}{solid}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egplboxlinecolor+\newline +\noindent Color of lines around boxes containing player labels. Possible +values: any defined color. Default: \verb+black+. Example: +\verb+\renewcommand{\egplboxlinecolor}+ \verb+{gray}+. + +\vspace{4mm} + +\noindent\verb+\egplboxfillstyle+\newline +\noindent Style of fill of boxes containing player labels. Possible values: +\verb+none+, \verb+solid+, \verb+vlines+, \verb+vlines*+, \verb+hlines+, +\verb+hlines*+, \verb+crosshatch+, \verb+crosshatch*+. Default: \verb+none+. +Example: \verb+\renewcommand{\egplboxfillstyle}{solid}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\egplboxfillcolor+\newline +\noindent Color of fill of boxes containing player labels. Possible values: +any defined color. Default: \verb+white+. Example: +\verb+\renewcommand{\egplboxfillcolor}+ \verb+{gray}+. + +\fussy +\vspace{4mm} + +\noindent\verb+\egarrowstyle+\newline +\noindent Style of arrows on branches. Possible values: \verb+n+ (none), +\verb+e+ (end), \verb+m+ (mid). Default: \verb+n+ (none). Example: +\verb+\renewcommand{\egarrowstyle}{m}+ (mid). The size of the arrows can be +adjusted by using any of the PSTricks parameters---e.g.\ +\verb+\psset{arrowscale=1.5}+. + +\vspace{4mm} + +\sloppy +\noindent\verb+\ctmfillcolor+\newline +\noindent Color of triangle used to indicate continuum of branches. Possible +values: any defined color. Default: \verb+verylightgray+. Example: +\verb+\renewcommand+ \verb+{\ctmfillcolor}{red}+. + +\fussy +\section{Suggestions} +It seems hard to proceed without first drawing the game on a piece of paper, +at least roughly. Be sure to allow enough space under (in the case of a +downward-pointing game) the terminal nodes---put the nodes that precede the +terminal nodes high enough that the bottom of the payoffs will be at height 0. + Similarly, specify the height of the game so that the label for the initial +player does not poke out the top. If parts of your game poke out of the frame +defined by the size you specify for your \verb+egame+, \TeX\ will not warn +you, but the spacing above and/or below your game will not be right. (If you +specify the height to be too small, for example, the top of your game may +overlap the text above it.) + +You can float your game in a figure (as I have done in the examples above), or +you can put it in the text. (For example, you may use +\verb+$$\begin{egame}...+ \verb+\end{egame}$$+). Putting it in the text has +the disadvantage that if it's big and happens to start at the bottom of a page +then you may get a lot of white space if it doesn't fit on the page. +\section{Enhancements} +It would be nice to have a graphical interface, like that in \LaTeX CAD\@. +I'm not capable of writing one. + +It would be nice also if the macros could calculate the dimensions of the +whole game, so the the user does not have to specify them in the +\verb+\begin{game}+ call. To make this change looks like a tough project to +me. + +The label-positioning algorithm could be enhanced, as discussed in +Section~\ref{s:alp}. + +\section{History} +\begin{description} +\item[Version 1.0] 2001-4-9 (based on EGAME.STY, 1997-10-16) +\item[Version 1.1] 2004-6-19 (\verb+\egctmarc+ added, following suggestion of +Paul Schweinzer). +\end{description} + +\section{Appendix: using pdftricks with pdftex to create a pdf +file}\label{s:pdftricks} +If you want to create a pdf file from your \LaTeX\ file and do not want to +take the dvi $\rightarrow$ ps $\rightarrow$ pdf route, you may use +\verb+pdftricks+. Eric Gartzke reports that the following input produces the +expected output. (See his comments for the limitations of this method.) If +you find a better solution, please let me know. + +\begin{verbatim}\documentclass[12pt]{article} +\usepackage[shell]{pdftricks} + +\begin{psinputs} +\usepackage{pstricks} +\usepackage{color} +\usepackage{pstcol} +\usepackage{pst-plot} +\usepackage{pst-tree} +\usepackage{pst-eps} +\usepackage{multido} +\usepackage{pst-node} +\usepackage{pst-eps} +\usepackage{egameps} +\end{psinputs} + +\usepackage{amsfonts} +\usepackage{graphicx} +\usepackage{amsmath} +\usepackage{setspace} +\usepackage{fullpage} +\usepackage{harvard} +\usepackage{threeparttable} +\usepackage{amssymb} + +\newtheorem{hypothesis}{Hypothesis} + +Postscript commands need to be separated from other commands. +pdftricks literally stops the compiling of the TeX file to run +postscript/dvi in the background, generating separate small +TeX files and pdf files of each figure. Notice that egameps +is called last. This seems to make a considerable +difference. Here is an example of a simple egame tree. + +\begin{pdfpic} +\begin{figure}[htb] +\hspace*{\fill} +\begin{egame}(600,1250) +\renewcommand{\egarrowstyle}{e} +\renewcommand{\egnode}{\pscircle*{8}} +\putbranch(200,1200)(0,1){150} \ib{$N$}[r]{$~k_{i},~k_{j}$} +\renewcommand{\egarrowstyle}{} +\putbranch(200,1050)(1,1){200} \egdirection{d} +\iib{$i$}[l]{$\begin{array}{c}Status\\Quo\end{array}$}{$Challenge$}[$b_{ +i},~1+b_{j}$][] +\putbranch(400,850)(1,1){200} +\iib{$~j$}[r]{$Reject$}{$Accept$}[][$\begin{array}{c}1- +d+b_{i},\\d+b_{j}\end{array}$] +\putbranch(200,650)(1,1){200} +\iib{$i$}[l]{$\begin{array}{c}Back\\Down\end{array}$}{$Persist$}[$\begin +{array}{c}-a_{i},\\1\end{array}$][] +\putbranch(400,450)(1,1){200} +\iib{$j$}[r]{$Fight$}{$Acquiesce$}[$\begin{array}{c}p-k_{i},\\1-p- +k_{j}\end{array}$][$\begin{array}{c}1-d,\\d\end{array}$] +\end{egame} +\setcounter{figure}{1} +\hspace*{\fill} \caption[]{Selection Game +\label{figure:selection}} +\end{figure} +\end{pdfpic} + +Again, the figure is isolated from the rest of the TeX file by +pdftricks commands. Also, the regular LaTeX numbering of +figures is interfered with, so I adjust with a \setcounter +command. Finally, the \label and \reference commands do not +work, so one must simply number the figures in the text. +\end{verbatim} + + + +\end{document} + + + |