\font\sc=cmcsc10 at 12pt
\font\big=cmr10 at 24.87pt
\font\tt=cmtt10 at 20.73pt
\font\rm=cmr10 at 20.73pt \rm
\font\syy=cmsy10 at 14.4pt
\font\sy=cmsy10 at 20.73pt
\nopagenumbers
\hsize=9in
\vsize=6.5in
\def\rtm{${\hbox{\strut}}^{\hbox{\sc{}TM}}$}
% The following code is from page 380 of the TeXbook:
\def\uncatcodespecials{\def\do##1{\catcode`##1=12 }\dospecials}
% The following is from page 381 of the TeXbook:
\def\verbatim{\begingroup
\parindent=0pt\parskip=0pt
\tt\uncatcodespecials\obeyspaces\obeylines\doverbatim}
\newcount\balance
{\catcode`<=1 \catcode`>=2 \catcode`\{=12 \catcode`\}=12
\gdef\doverbatim{<\balance=1\verbatimloop>
\gdef\verbatimloop#1<\if #1*
\def\next<\ \verbatimloop>\else%
\def\next<#1\verbatimloop>\fi%
\if #1{\advance\balance by1
\else\if#1}\advance\balance by-1
\ifnum\balance=0\let\next=\endgroup\fi\fi\fi\next>>
% The preceeding is from page 381 of the TeXbook.
\def\newpage{\vfill\eject}
\long\def\itm#1{{\syy\char'017}\ {\narrower{}#1\par}}
\long\def\iitm#1{{\sy\char'017}\ {\narrower{}#1\par}}
%
%        Overheads for TUG conference presentation
%
\centerline{\big\TeX{}reation ---}
\medskip
\centerline{\big{}Playing Games with \TeX{}'s Mind}
\bigskip
\hrule
\vskip1in
\centerline{Andrew Marc Greene}
\smallskip
\centerline{\tt <amgreene@athena.mit.edu>}
\vskip1in
\centerline{Project Athena}
\centerline{and\strut}
\centerline{Student Information Processing Board}
\vskip1in
\centerline{Massachusetts Institute of Technology}
\centerline{Cambridge, MA 02139}
\newpage
%
\centerline{\big{}Outline}
\medskip
\hrule
\vfill
\iitm{Animals\par
\bigskip
\itm{Rules}
\smallskip
\itm{\TeX{} code to handle databases}
\smallskip
\itm{Application to ``CokeComm''}}
\vfill
\iitm{Battleship\rtm{}\par
\bigskip
\itm{Rules}
\smallskip
\itm{\TeX{} code to handle arrays}
\smallskip
\itm{Advantages}}
\vfill
\iitm{Conclusion --- The Next Step}
\newpage
%
\centerline{\big{}Animals}
\medskip
\hrule
\centerline{\special{psfile=animals.ps}}
\newpage
%
\centerline{\big{}Database Routines}
\medskip
\hrule
\bigskip
The {\tt Query} routine selects the next record.

\vskip1in
\verbatim{\def\Query{
*{\read\inp to \foo                        %  QUESTION
**\immediate\write16{}
**\message{\foo}         
**\GetYN
**\ifyn
***\read\inp to \foo\global\curcode=\foo %  YES-GOTO
***\read\inp to \foo                     %  NO-GOTO
**\else
***\read\inp to \foo                     %  YES-GOTO
***\read\inp to \foo\global\curcode=\foo %  NO-GOTO
**\fi
*}
}}

\newpage
%
\centerline{\big{}Battleship\rtm}
\medskip
\hrule
\bigskip
\special{psfile=battle.ps}
\vfill
\eject
%
\centerline{\big{}Arrays --- First Method}
\medskip
\hrule
\bigskip
\special{psfile=array1.ps}
\newpage
%
\centerline{\big{}Arrays --- Second Method}
\medskip
\hrule
\bigskip

The {\tt get} macro expands to the element value.

\vskip.5in
\verbatim{\def\get#1#2{
**\csname #1.
***\if\relax #2\the\fi
***#2
**\endcsname
}
}

\vfill

The {\tt put} prefix is used to make the {\tt def} family
work with arrays.

\vskip.5in
\verbatim{\def\put#1#2#3{
**\expandafter #1\csname #2.
***\if\relax #3\the\fi
***#3\endcsname
}}
\newpage
%
\centerline{Random-Access Database}
\medskip
\hrule\bigskip

We can rewrite the main loop of Animals:

\vskip.5in
\verbatim{\fields question,yesgoto,nogoto\endfields
\readdatabase{animals.db}
\gotorecord 1
\loop
**\message{\question}\getYN
**\ifyn \gotorecord \yesgoto
***\else \gotorecord \nogoto
**\fi
**\ifnum\recordnumber>0
\repeat
}
\vfill
Other supported commands:
\medskip
\verbatim{\foreachrecord, \writedatabase, \newrecord, \saverecord}

\newpage
%
\centerline{Available by Anonymous ftp}
\medskip
\hrule\vskip1in
\centerline{\tt gevalt.mit.edu}
\medskip
\centerline{\tt (18.72.1.4)}
\medskip
\centerline{\tt TeX/dblib.tex}
\vskip1in
\centerline{Also over the Andrew File System:}
\medskip
\centerline{\tt /afs/athena.mit.edu/user/a/amgreene/TeXhax/dblib.tex}
\newpage
\bye

