summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/egameps/egameps.tex
blob: 20c902f954fc447f9f4f1d1caf78ae5913271d8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
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}