%% %% This is file `cryptocode.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% cryptocode.dtx (with options: `cryptocode.sty,package') %% %% cryptocode.dtx %% Copyright 2020 Mittelbach, Arno %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% %% This work has the LPPL maintenance status `maintained'. %% %% The Current Maintainer of this work is Mittelbach, Arno. %% %% This work consists of the files cryptocode.dtx and cryptocode.ins and the derived files %% cryptocode.sty and cryptocode.pdf. %% \NeedsTeXFormat{LaTeX2e} \DeclareRelease{v0.30}{2018-11-11}{cryptocode-2018-11-11.sty} \DeclareRelease{v0.32}{2020-04-24}{cryptocode-2020-04-24.sty} \DeclareCurrentRelease{v0.40}{2020-07-10} \ProvidesPackage{cryptocode} [2020/07/10 v0.40 Cryptocode LaTeX package for typesetting pseudocode, algorithms and protocols as well as cryptographic proofs.] \RequirePackage{amsmath} \RequirePackage{mathtools} \newif\if@pc@opt@amsfonts \newif\if@pc@opt@advantage \newif\if@pc@opt@centernot \DeclareOption{operators}{ \providecommand{\sample}{\hskip2.3pt{\gets\!\!\mbox{\scriptsize${\$}$\normalsize}}\,} \DeclarePairedDelimiter\pc@floor{\lfloor}{\rfloor} \providecommand{\floor}[1]{\pc@floor*{#1}} \providecommand{\tfloor}[1]{\pc@floor{#1}} \DeclarePairedDelimiter\pc@ceil{\lceil}{\rceil} \providecommand{\ceil}[1]{\pc@ceil*{#1}} \providecommand{\tceil}[1]{\pc@ceil{#1}} \DeclarePairedDelimiter\pc@Angle{\langle}{\rangle} \providecommand{\Angle}[1]{\pc@Angle*{#1}} \providecommand{\tAngle}[1]{\pc@Angle{#1}} \DeclarePairedDelimiter\pc@abs{\lvert}{\rvert} \providecommand{\abs}[1]{\pc@abs*{#1}} \providecommand{\tabs}[1]{\pc@abs{#1}} \DeclarePairedDelimiter\pc@norm{\lVert}{\rVert} \providecommand{\norm}[1]{\pc@norm*{#1}} \providecommand{\tnorm}[1]{\pc@tnorm{#1}} \providecommand{\concat}{\ensuremath{\|}} \providecommand{\emptystring}{\ensuremath{\varepsilon}} \DeclareMathOperator*{\argmax}{arg\,max} \DeclareMathOperator*{\argmin}{arg\,min} \newcommand{\@pc@oset}[3][0ex]{% \mathrel{\mathop{#3}\limits^{ \vbox to#1{\kern-2\ex@ \hbox{$\scriptstyle#2$}\vss}}}} \newcommand{\pindist}{\@pc@oset{\text{p}}{\lower.2ex\hbox{$=$}}} \newcommand{\sindist}{\@pc@oset{\text{s}}{\lower.1ex\hbox{$\approx$}}} \newcommand{\cindist}{\@pc@oset{\text{c}}{\lower.1ex\hbox{$\approx$}}} } \DeclareOption{adversary}{ \providecommand{\adversary}[1]{\pcadvstyle{#1}} \providecommand{\adv}{\pcadvstyle{A}} \providecommand{\bdv}{\pcadvstyle{B}} \providecommand{\cdv}{\pcadvstyle{C}} \providecommand{\ddv}{\pcadvstyle{D}} \providecommand{\edv}{\pcadvstyle{E}} \providecommand{\mdv}{\pcadvstyle{M}} \providecommand{\pdv}{\pcadvstyle{P}} \providecommand{\rdv}{\pcadvstyle{R}} \providecommand{\sdv}{\pcadvstyle{S}} } \DeclareOption{landau}{ \providecommand{\bigO}[1]{\ensuremath{\mathcal{O}\pc@olrk*{#1}}} \providecommand{\smallO}[1]{\ensuremath{\text{o}\pc@olrk*{#1}}} \providecommand{\bigOmega}[1]{\ensuremath{\Omega\pc@olrk*{#1}}} \providecommand{\smallOmega}[1]{\ensuremath{\omega\pc@olrk*{#1}}} \providecommand{\bigsmallO}[1]{% \PackageWarning{cryptocode}{bigsmallO is deprecated. Use bigTheta instead.}% \ensuremath{\Theta\pc@olrk*{#1}}} \providecommand{\bigTheta}[1]{\ensuremath{\Theta\pc@olrk*{#1}}} \providecommand{\orderOf}{\ensuremath{\sim}} } \DeclareOption{probability}{ \@pc@opt@amsfontstrue \providecommand{\probname}{Pr} \providecommand{\expectationname}{\ensuremath{\mathbb{E}}} \providecommand{\supportname}{Supp} \providecommand{\tprob}[1]{\ensuremath{\operatorname{\probname}\pc@elrk{#1}}} \providecommand{\prob}[1]{\ensuremath{\operatorname{\probname}\pc@elrk*{#1}}} \providecommand{\tprobsub}[2]{\ensuremath{\operatorname{\probname}_{#1}\pc@elrk{#2}}} \providecommand{\probsub}[2]{\ensuremath{\operatorname{\probname}_{#1}\pc@elrk*{#2}}} \providecommand{\probsublong}[2]{\ensuremath{\prob{#2\,:\,#1}}} \providecommand{\tcondprob}[2]{\ensuremath{\tprob{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\condprob}[2]{\ensuremath{\prob{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\tcondprobsub}[3]{\ensuremath{\tprobsub{#1}{#2\,\left|\,#3\vphantom{#1}\right.}}} \providecommand{\condprobsub}[3]{\ensuremath{\probsub{#1}{#2\,\left|\,#3\vphantom{#1}\right.}}} \providecommand{\texpect}[1]{\ensuremath{\operatorname{\expectationname}\pc@elrk{#1}}} \providecommand{\expect}[1]{\ensuremath{\operatorname{\expectationname}\pc@elrk*{#1}}} \providecommand{\texpsub}[2]{\ensuremath{\operatorname{\expectationname}_{#1}\pc@elrk{#2}}} \providecommand{\expsub}[2]{\ensuremath{\operatorname{\expectationname}_{#1}\pc@elrk*{#2}}} \providecommand{\tcondexp}[2]{\ensuremath{\texpect{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\condexp}[2]{\ensuremath{\expect{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\tcondexpsub}[3]{\ensuremath{\texpsub{#1}{#2\,\left|\,#3\vphantom{#1}\right.}}} \providecommand{\condexpsub}[3]{\ensuremath{\expsub{#1}{#2\,\left|\,#3\vphantom{#1}\right.}}} \providecommand{\supp}[1]{\ensuremath{\operatorname{Supp}\pc@olrk*{#1}}} \providecommand{\entropy}[1]{\ensuremath{\operatorname{H}\pc@olrk*{#1}}} \providecommand{\condentropy}[2]{% \ensuremath{\operatorname{H}\pc@olrk*{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\minentropy}[1]{\ensuremath{\operatorname{H_\infty}\pc@olrk*{#1}}} \providecommand{\tminentropy}[1]{\ensuremath{\operatorname{H_\infty}\pc@olrk{#1}}} \providecommand{\condminentropy}[2]{% \ensuremath{\operatorname{H_\infty}\pc@olrk*{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\tcondminentropy}[2]{% \ensuremath{\operatorname{H_\infty}\pc@olrk{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\condavgminentropy}[2]{% \ensuremath{\operatorname{\tilde{H}_\infty}\pc@olrk*{#1\,\left|\,#2\vphantom{#1}\right.}}} \providecommand{\tcondavgminentropy}[2]{% \ensuremath{\operatorname{\tilde{H}_\infty}\pc@olrk{#1\,\left|\,#2\vphantom{#1}\right.}}} } \DeclareOption{sets}{ \@pc@opt@amsfontstrue \providecommand\NN{\pcsetstyle{N}} \providecommand\ZZ{\pcsetstyle{Z}} \providecommand\CC{\pcsetstyle{C}} \providecommand\QQ{\pcsetstyle{Q}} \providecommand\RR{\pcsetstyle{R}} \providecommand\PP{\pcsetstyle{P}} \providecommand\FF{\pcsetstyle{F}} \providecommand\GG{\pcsetstyle{G}} \providecommand{\set}[1]{\ensuremath{\pc@clrk*{#1}}} \providecommand{\sequence}[1]{\ensuremath{\pc@olrk*{#1}}} \providecommand{\bin}{\ensuremath{\{0,1\}}} } \DeclareOption{noamsfonts}{ \@pc@opt@amsfontsfalse } \DeclareOption{notions}{ \providecommand{\indcpa}{\pcnotionstyle{IND\pcmathhyphen{}CPA}} \providecommand{\indcca}{\pcnotionstyle{IND\pcmathhyphen{}CCA}} \providecommand{\indccai}{\pcnotionstyle{IND\pcmathhyphen{}CCA1}} \providecommand{\indccaii}{\pcnotionstyle{IND\pcmathhyphen{}CCA2}} \providecommand{\priv}{\pcnotionstyle{PRIV}} \providecommand{\ind}{\pcnotionstyle{IND}} \providecommand{\indcda}{\pcnotionstyle{IND\pcmathhyphen{}CDA}} \providecommand{\prvcda}{\pcnotionstyle{PRV\pcmathhyphen{}CDA}} \providecommand{\prvrcda}{\pcnotionstyle{PRV\$\pcmathhyphen{}CDA}} \providecommand{\kiae}{\pcnotionstyle{KIAE}} \providecommand{\kdae}{\pcnotionstyle{KDAE}} \providecommand{\mle}{\pcnotionstyle{MLE}} \providecommand{\uce}{\pcnotionstyle{UCE}} \providecommand{\eufcma}{\pcnotionstyle{EUF\pcmathhyphen{}CMA}} \providecommand{\eufnacma}{\pcnotionstyle{EUF\pcmathhyphen{}naCMA}} \providecommand{\seufcma}{\pcnotionstyle{SUF\pcmathhyphen{}CMA}} \providecommand{\eufko}{\pcnotionstyle{EUF\pcmathhyphen{}KO}} } \DeclareOption{logic}{ \@pc@opt@centernottrue \providecommand{\AND}{\ensuremath{\mathrm{AND}}} \providecommand{\OR}{\ensuremath{\mathrm{OR}}} \providecommand{\NOR}{\ensuremath{\mathrm{NOR}}} \providecommand{\NOT}{\ensuremath{\mathrm{NOT}}} \providecommand{\NAND}{\ensuremath{\mathrm{NAND}}} \providecommand{\XOR}{\ensuremath{\mathrm{XOR}}} \providecommand{\XNOR}{\ensuremath{\mathrm{XNOR}}} \providecommand{\xor}{\ensuremath{\oplus}} \providecommand{\false}{\mathsf{false}} \providecommand{\true}{\mathsf{true}} \providecommand{\notimplies}{\centernot\implies} } \DeclareOption{ff}{ \providecommand{\kgen}{\pcalgostyle{KGen}} \providecommand{\pgen}{\pcalgostyle{Pgen}} \providecommand{\eval}{\pcalgostyle{Eval}} \providecommand{\invert}{\pcalgostyle{Inv}} \providecommand{\il}{\pcalgostyle{il}} \providecommand{\ol}{\pcalgostyle{ol}} \providecommand{\kl}{\pcalgostyle{kl}} \providecommand{\nl}{\pcalgostyle{nl}} \providecommand{\rl}{\pcalgostyle{rl}} } \DeclareOption{mm}{ \providecommand{\CRKT}{\pcmachinemodelstyle{C}} \providecommand{\TM}{\pcmachinemodelstyle{M}} \providecommand{\PROG}{\pcmachinemodelstyle{P}} \providecommand{\uTM}{\pcmachinemodelstyle{UM}} \providecommand{\uC}{\pcmachinemodelstyle{UC}} \providecommand{\uP}{\pcmachinemodelstyle{UEval}} \providecommand{\csize}{\pcmachinemodelstyle{size}} \providecommand{\tmtime}{\pcmachinemodelstyle{time}} \providecommand{\ppt}{\pcalgostyle{PPT}} } \DeclareOption{advantage}{ \@pc@opt@advantagetrue } \DeclareOption{primitives}{ \providecommand{\prover}{\pcalgostyle{P}} \providecommand{\verifier}{\pcalgostyle{V}} \providecommand{\nizk}{\pcalgostyle{NIZK}} \providecommand{\hash}{\pcalgostyle{H}} \providecommand{\gash}{\pcalgostyle{G}} \providecommand{\fash}{\pcalgostyle{F}} \providecommand{\pad}{\pcalgostyle{pad}} \providecommand{\enc}{\pcalgostyle{Enc}} \providecommand{\dec}{\pcalgostyle{Dec}} \providecommand{\sig}{\pcalgostyle{Sig}} \providecommand{\sign}{\pcalgostyle{Sign}} \providecommand{\verify}{\pcalgostyle{Vf}} \providecommand{\obf}{\pcalgostyle{O}} \providecommand{\iO}{\pcalgostyle{iO}} \providecommand{\diO}{\pcalgostyle{diO}} \providecommand{\owf}{\pcalgostyle{OWF}} \providecommand{\owp}{\pcalgostyle{OWP}} \providecommand{\tdf}{\pcalgostyle{TF}} \providecommand{\inv}{\pcalgostyle{Inv}} \providecommand{\hcf}{\pcalgostyle{HC}} \providecommand{\prf}{\pcalgostyle{PRF}} \providecommand{\prp}{\pcalgostyle{PRP}} \providecommand{\prg}{\pcalgostyle{PRG}} \providecommand{\mac}{\pcalgostyle{MAC}} \providecommand{\puncture}{\pcalgostyle{Puncture}} \providecommand{\source}{\pcalgostyle{S}} \providecommand{\predictor}{\pcalgostyle{P}} \providecommand{\sam}{\pcalgostyle{Sam}} \providecommand{\dist}{\pcalgostyle{D}} \providecommand{\distinguisher}{\pcalgostyle{Dist}} \providecommand{\simulator}{\pcalgostyle{Sim}} \providecommand{\ext}{\pcalgostyle{Ext}} \providecommand{\extractor}{\ext} } \DeclareOption{oracles}{ \providecommand{\Oracle}[1]{\pcalgostyle{O{#1}}} \def\oracle{\bgroup\oracle@} \newcommand{\oracle@}[1][]{\ifthenelse{\equal{#1}{}}{\oracle@@{O}}{\oracle@@{#1}}} \def\oracle@@#1{\pcoraclestyle{#1}\egroup} \providecommand{\ro}{\pcoraclestyle{RO}} } \DeclareOption{events}{ \providecommand{\event}[1]{\ensuremath{\mathsf{#1}}} \providecommand{\nevent}[1]{\ensuremath{\overline{\event{#1}}}} \providecommand{\bad}{\ensuremath{\event{bad}}} \providecommand{\nbad}{\ensuremath{\nevent{bad}}} } \DeclareOption{complexity}{ \providecommand{\complclass}[1]{\pccomplexitystyle{#1}} \providecommand{\cocomplclass}[1]{\pccomplexitystyle{co}\pcmathhyphen{}\pccomplexitystyle{#1}} \providecommand{\npol}{\pccomplexitystyle{NP}} \providecommand{\conpol}{\cocomplclass{NP}} \providecommand{\pol}{\pccomplexitystyle{P}} \providecommand{\bpp}{\pccomplexitystyle{BPP}} \providecommand{\ppoly}{\ensuremath{\pol/\mathrm{poly}}} \providecommand{\AM}{\pccomplexitystyle{AM}} \providecommand{\coAM}{\cocomplclass{AM}} \providecommand{\AC}[1]{\ensuremath{\ifthenelse{\equal{#1}{}}{\pccomplexitystyle{AC}}{\pccomplexitystyle{AC}^{#1}}}} \providecommand{\NC}[1]{\ensuremath{\ifthenelse{\equal{#1}{}}{\pccomplexitystyle{NC}}{\pccomplexitystyle{NC}^{#1}}}} \providecommand{\TC}[1]{\ensuremath{\ifthenelse{\equal{#1}{}}{\pccomplexitystyle{TC}}{\pccomplexitystyle{TC}^{#1}}}} \providecommand{\PH}{\pccomplexitystyle{PH}} \providecommand{\csigma}[1]{\pccomplexitystyle{\Sigma}^p_{#1}} \providecommand{\cpi}[1]{\pccomplexitystyle{\Pi}^p_{#1}} \providecommand{\cosigma}[1]{\cocomplclass{\Sigma}^p_{#1}} \providecommand{\copi}[1]{\cocomplclass{\Pi}^p_{#1}} } \DeclareOption{asymptotics}{ \providecommand{\negl}[1][\secpar]{% \pcpolynomialstyle{negl}\ifthenelse{\equal{#1}{}}{}{\pc@olrk*{#1}}} \providecommand{\poly}[1][\secpar]{% \pcpolynomialstyle{poly}\ifthenelse{\equal{#1}{}}{}{\pc@olrk*{#1}}} \def\pp{\bgroup\pp@} \newcommand{\pp@}[1][]{\ifthenelse{\equal{#1}{}}{\pp@@{p}}{\pp@@{#1}}} \def\pp@@#1{\pcpolynomialstyle{#1}\egroup} \providecommand{\cc}{\pcpolynomialstyle{c}} \providecommand{\ee}{\pcpolynomialstyle{e}} \providecommand{\kk}{\pcpolynomialstyle{k}} \providecommand{\mm}{\pcpolynomialstyle{m}} \providecommand{\nn}{\pcpolynomialstyle{n}} \providecommand{\qq}{\pcpolynomialstyle{q}} \providecommand{\rr}{\pcpolynomialstyle{r}} } \DeclareOption{keys}{ \providecommand{\pk}{\pckeystyle{pk}} \providecommand{\vk}{\pckeystyle{vk}} \providecommand{\sk}{\pckeystyle{sk}} \def\key{\bgroup\key@} \newcommand{\key@}[1][]{\ifthenelse{\equal{#1}{}}{\key@@{k}}{\key@@{#1}}} \def\key@@#1{\pckeystyle{#1}\egroup} \providecommand{\hk}{\pckeystyle{hk}} \providecommand{\gk}{\pckeystyle{gk}} \providecommand{\fk}{\pckeystyle{fk}} \providecommand{\st}{\pckeystyle{st}} \def\state{\bgroup\state@} \newcommand{\state@}[1][]{\ifthenelse{\equal{#1}{}}{\state@@{state}}{\state@@{#1}}} \def\state@@#1{\pckeystyle{#1}\egroup} } \DeclareOption{n}{ \providecommand{\SECPAR}{\ensuremath{{N_0}}} \providecommand{\secpar}{\ensuremath{n}} \providecommand{\secparam}{\ensuremath{1^\secpar}} } \DeclareOption{lambda}{ \renewcommand{\SECPAR}{\ensuremath{\Lambda}} \renewcommand{\secpar}{\ensuremath{\lambda}} \renewcommand{\secparam}{\ensuremath{1^\secpar}} } \DeclareOption*{% \PackageError{cryptocode}{Unknown option ‘\CurrentOption’}% } \ExecuteOptions{n} \ProcessOptions\relax \RequirePackage{etex} \if@pc@opt@amsfonts \RequirePackage{amsfonts} \fi \if@pc@opt@centernot \RequirePackage{centernot} \fi \RequirePackage{xcolor} \RequirePackage{calc} \RequirePackage{tikz} \usetikzlibrary{positioning,calc} \RequirePackage{ifthen} \RequirePackage{xargs} \RequirePackage{pgf} \RequirePackage{forloop} \RequirePackage{array} \RequirePackage{xparse} \RequirePackage{expl3} \RequirePackage{pbox} \RequirePackage{varwidth} \RequirePackage{suffix} \RequirePackage{etoolbox} \RequirePackage{environ} \RequirePackage{xkeyval} \if@pc@opt@advantage \providecommand{\pcadvantagesuperstyle}[1]{\mathrm{\MakeLowercase{#1}}} \providecommand{\pcadvantagesubstyle}[1]{#1} \providecommand{\pcadvantagename}{\mathsf{Adv}} \newcommandx*{\advantage}[3][3=(\secpar)]{\ensuremath{\pcadvantagename^{\pcadvantagesuperstyle{#1}}_{\pcadvantagesubstyle{#2}}#3}} \fi \providecommand{\pcalgostyle}[1]{\ensuremath{\mathsf{#1}}} \providecommand{\pcsetstyle}[1]{\ensuremath{\mathbb{#1}}} \providecommand{\pccomplexitystyle}[1]{\ensuremath{\mathsf{#1}}} \providecommand{\pcpolynomialstyle}[1]{\ensuremath{\mathsf{#1}}} \providecommand{\pcadvstyle}[1]{\ensuremath{\mathcal{#1}}} \providecommand{\pcnotionstyle}[1]{\ensuremath{\mathrm{#1}}} \providecommand{\pckeystyle}[1]{\ensuremath{\mathsf{\protect\vphantom{p}#1}}} \providecommand{\pcmachinemodelstyle}[1]{\ensuremath{\mathsf{#1}}} \providecommand{\pcoraclestyle}[1]{\ensuremath{\mathsf{#1}}} \DeclarePairedDelimiter\pc@olrk{(}{)} \DeclarePairedDelimiter\pc@elrk{[}{]} \DeclarePairedDelimiter\pc@clrk{\{}{\}} \newlength\pcaboveskip \setlength\pcaboveskip{\abovedisplayskip} \newlength\pcbelowskip \setlength\pcbelowskip{\belowdisplayskip} \newlength\pcbeforeskip \newlength\pcafterskip \newcommand{\highlightkeyword}[2][\ ]{\ensuremath{\mathbf{#2}}#1} \newcommand{\highlightaltkeyword}[2][\ ]{\ensuremath{\mathsf{#2}}#1} \newcommand{\pcglobvar}{\highlightkeyword{gbl}} \newcommand{\pcnew}{\highlightkeyword{new}} \newcommand{\pcwhile}{\@pc@increaseindent\highlightkeyword{while}} \newcommand{\pcendwhile}{\@pc@decreaseindent\highlightkeyword{endwhile}} \newcommandx*{\pcdo}[2][1=\ ,2=]{#1\highlightkeyword[#2]{do}} \newcommandx*{\pcif}[1][1=\ ]{\@pc@increaseindent\highlightkeyword[#1]{if}} \newcommandx*{\pcunless}[1][1=\ ]{\@pc@increaseindent\highlightkeyword[#1]{unless}} \newcommandx*{\pcelse}[1][1=\ ]{\@pc@tmpdecreaseindent\highlightkeyword[#1]{else}} \newcommandx*{\pcelseif}[1][1=\ ]{\@pc@tmpdecreaseindent\highlightkeyword[#1]{else if}} \newcommand{\pcfi}{\@pc@decreaseindent\highlightkeyword{fi}} \newcommand{\pcendif}{\@pc@decreaseindent\highlightkeyword{endif}} \newcommand{\pcendfor}{\@pc@decreaseindent\highlightkeyword{endfor}} \newcommandx*{\pcthen}[2][1=\ ,2=\ ]{#1\highlightkeyword[#2]{then}} \newcommand{\pcreturn}{\highlightkeyword{return}} \newcommandx*{\pcin}[2][1=\ ,2=]{#1\highlightkeyword[#2]{in}} \newcommandx*{\pcfor}[1][1=\ ]{\@pc@increaseindent\highlightkeyword[#1]{for}} \newcommand{\pcrepeat}[1]{% \@pc@increaseindent\ensuremath{% \highlightkeyword{repeat} #1\ \highlightkeyword{times}% }} \newcommand{\pcrepeatuntil}[2]{% \ensuremath{\highlightkeyword{repeat}\ #1\ \highlightkeyword{until}\ #2}} \newcommand{\pcforeach}{\@pc@increaseindent\highlightkeyword{foreach}} \newcommand{\pcendforeach}{\@pc@decreaseindent\highlightkeyword{endforeach}} \newcommand{\pcuntil}{\@pc@decreaseindent\highlightkeyword{until}} \newcommand{\pccontinue}{\highlightkeyword{continue}} \newcommandx*{\pcfalse}[2][1=\ ,2=]{\highlightkeyword[#2]{false}} \newcommandx*{\pctrue}[2][1=\ ,2=]{\highlightkeyword[#2]{true}} \newcommandx*{\pcnull}[2][1=\ ,2=]{\highlightkeyword[#2]{null}} \newcommand{\pcdone}{\highlightkeyword{done}} \newcommand{\pcparse}{\highlightkeyword{parse}} \newcommand{\pcfail}{\highlightkeyword{fail}} \newcommand{\pcabort}{\highlightkeyword{abort}} \mathchardef\pcmathhyphen ="2D \newcommand{\pccomment}[2][1em]{\hspace{#1}{\mbox{/\!\!/ } \text{\scriptsize#2}}} \newcommand{\pclinecomment}[2][0em]{\hspace{#1}{\mbox{/\!\!/ } \text{\scriptsize#2}}} \newcommand\@pc@ifinfloat[2]{\ifnum\@floatpenalty<0\relax#1\else#2\fi} \newcommand*\@expandedsetkeys[5]{\expandafter\@expandedsetkeys@\expandafter{#4}{#1}{#2}{#3}{#5}} \def\@expandedsetkeys@#1#2#3#4#5{\setkeys{#2}[#3]{#4,#1,#5}} \newenvironment{@pc@withspaces} {\obeyspaces\begingroup\lccode`~=` \lowercase{\endgroup\let~}\ } {} \newcommand{\@pc@settowidthofalign}[2]{% \setbox\z@=\vbox{\@pseudocodecodesize \begin{flalign*} #2 \ifmeasuring@\else\global\let\got@maxcolwd\maxcolumn@widths\fi \end{flalign*} }% \begingroup \def\or{+}\edef\x{\endgroup#1=\dimexpr\got@maxcolwd\relax}\x} \newcommand{\@pc@settowidthofaligned}[2]{% \settowidth{#1}{\@pseudocodesubcodesize$\begin{aligned}#2\end{aligned}$}} \def\@pc@ifdraft{\ifdim\overfullrule>\z@ \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi} \newcommand{\@pc@executeblindly}[1]{% \setbox\z@=\vbox{#1 }} \AtBeginDocument{ \let\@pc@original@label\ltx@label } \newcommand*{\@pc@globaladdtolength}[2]{% \addtolength{#1}{#2}% \global#1=#1\relax} \newcommand*{\@pc@globalsetlength}[2]{% \setlength{#1}{#2}% \global#1=#1\relax} \newcounter{@pc@global@pc@cnt} \newcounter{@pc@global@pc@nestcnt} \providecommand{\pcfixhyperref}{ \global\let\textlabel\label \global\let\@pc@original@label\textlabel %\global\let\@pc@original@label\relax %\global\let\label\relax } \newcommand{\pchspace}[1][1em]{\hspace{#1}} \newcommand{\pcvspace}[1][\baselineskip]{\par\vspace{#1}} \newcounter{@pc@stackdepth} \newcommand{\@pc@incstackdepth}{\addtocounter{@pc@stackdepth}{1}} \newcommand{\@pc@decstackdepth}{\addtocounter{@pc@stackdepth}{-1}} \newcommand{\@pc@centerstack}{false} \define@key{pcstack}{center}[true]{\ifthenelse{\equal{#1}{true}} {\renewcommand{\@pc@centerstack}{true}} {\renewcommand{\@pc@centerstack}{false}}}% \newcommand{\@pc@boxedstack}{false} \define@key{pcstack}{boxed}[true]{\ifthenelse{\equal{#1}{true}} {\renewcommand{\@pc@boxedstack}{true}} {\renewcommand{\@pc@boxedstack}{false}}}% \newcommand{\@pc@noindentstack}{false} \define@key{pcstack}{noindent}[true]{\ifthenelse{\equal{#1}{true}} {\renewcommand{\@pc@noindentstack}{true}} {\renewcommand{\@pc@noindentstack}{false}}}% \newcommand{\@pc@inlinestack}{false} \define@key{pcstack}{inline}[true]{\ifthenelse{\equal{#1}{true}} {\renewcommand{\@pc@inlinestack}{true}} {\renewcommand{\@pc@inlinestack}{false}}}% \providecommand{\pchstackspace}{0pt} \providecommand{\pcvstackspace}{0pt} \newcommand{\@pc@stackspace@forpseudocode}{} \newlength{\@pc@stackspace@len} \newcommand*{\@pc@stackspace}{0pt} \newcommand*{\@pc@reset@stackspace}{\setlength{\@pc@stackspace@len}{\@pc@stackspace}} \define@key{pcstack}{space}[0pt]{\renewcommand*{\@pc@stackspace}{#1}}% \newcommand{\@pc@addabovespaceunlessstacking}{% \ifthenelse{\value{@pc@stackdepth}=0}{\par\addvspace{\pcaboveskip}}{}} \newcommand{\@pc@applyaboveskipinstack}{\@pc@addabovespaceunlessstacking} \let\org@pc@applyaboveskipinstack\@pc@applyaboveskipinstack \define@key{pcstack}{aboveskip}[default]{\ifthenelse{\equal{#1}{default}} {\renewcommand{\@pc@applyaboveskipinstack}{\org@pc@applyaboveskipinstack}} {\renewcommand{\@pc@applyaboveskipinstack}{\vspace{#1}}}}% \newcommand{\@pc@addbelowspaceunlessstacking}{% \ifthenelse{\value{@pc@stackdepth}=0} {\@pc@ifinfloat{}{\par\addvspace{\pcbelowskip}}} {}} \newcommand{\@pc@applybelowskipinstack}{\@pc@addbelowspaceunlessstacking} \let\org@pc@applybelowskipinstack\@pc@addbelowspaceunlessstacking \define@key{pcstack}{belowskip}[default]{\ifthenelse{\equal{#1}{default}} {\renewcommand{\@pc@applybelowskipinstack}{\org@pc@applybelowskipinstack}} {\renewcommand{\@pc@applybelowskipinstack}{\par\addvspace{#1}}}}% \newlength{\pcbeforehstackskip} \newlength{\pcafterhstackskip} \newsavebox{\@pc@stackcontentbox}% \newcommand*\@pc@hstack@defaultargs{} \newcommand*\pcsethstackargs[1]{\renewcommand*\@pc@hstack@defaultargs{#1}} \newcommand*\@pc@vstack@defaultargs{} \newcommand*\pcsetvstackargs[1]{\renewcommand*\@pc@vstack@defaultargs{#1}} \newenvironment{pccenter}{% \setlength\topsep{0pt}\setlength\parskip{0pt}% \begin{center}}{\end{center}} \NewEnviron{pchstack}[1][]{% \begingroup% \@expandedsetkeys{pcstack}{}{center=false,boxed=false,aboveskip=default,belowskip=default,space=\pchstackspace}{\@pc@hstack@defaultargs}{#1}% \@pc@reset@stackspace% \ifthenelse{\equal{\@pc@inlinestack}{true}}{}{\@pc@applyaboveskipinstack}% \@pc@incstackdepth% \renewcommand{\@pc@stackspace@forpseudocode}{\hspace{\@pc@stackspace}}% \ifthenelse{\equal{\@pc@boxedstack}{true}}% {\sbox{\@pc@stackcontentbox} {\fbox{\mbox{\hspace{\pcbeforehstackskip}\BODY\hspace{\pcafterhstackskip}\hspace{-\@pc@stackspace}}}}}% {\sbox{\@pc@stackcontentbox} {\mbox{\hspace{\pcbeforehstackskip}\BODY\hspace{\pcafterhstackskip}\hspace{-\@pc@stackspace}}}}% \ifthenelse{\equal{\@pc@noindentstack}{true}}{\par\noindent\ignorespaces}{}% \ifthenelse{\equal{\@pc@centerstack}{true}}% {\begin{pccenter}\usebox{\@pc@stackcontentbox}\end{pccenter}} {\usebox{\@pc@stackcontentbox}}% \@pc@decstackdepth% \ifthenelse{\equal{\@pc@inlinestack}{true}}{}{\@pc@applybelowskipinstack}% \endgroup%reset space outside group \@pc@reset@stackspace% \@pc@stackspace@forpseudocode% \ignorespacesafterend\noindent% } \NewEnviron{pcvstack}[1][]{% \begingroup% \@expandedsetkeys{pcstack}{}{center=false,boxed=false,aboveskip=default,belowskip=default,space=\pcvstackspace}{\@pc@vstack@defaultargs}{#1}% \@pc@reset@stackspace% \@pc@applyaboveskipinstack% \@pc@incstackdepth% \renewcommand{\@pc@stackspace@forpseudocode}{\par\vspace{\@pc@stackspace}}% \sbox{\@pc@stackcontentbox}{% \ifthenelse{\equal{\@pc@boxedstack}{true}}% {\fbox{\raisebox{\dimexpr\ht\strutbox-\height}{\begin{varwidth}[t]{2\linewidth}\BODY\end{varwidth}}}}% {\raisebox{\dimexpr\ht\strutbox-\height}{\begin{varwidth}[t]{2\linewidth}\BODY\end{varwidth}}}% \vspace{-\@pc@stackspace}}% \ifthenelse{\equal{\@pc@noindentstack}{true}}{\par\noindent\ignorespaces}{}% \ifthenelse{\equal{\@pc@centerstack}{true}}% {\begin{pccenter}\usebox{\@pc@stackcontentbox}\end{pccenter}}% {\usebox{\@pc@stackcontentbox}}% \@pc@decstackdepth% \@pc@applybelowskipinstack% \endgroup%reset space outside group \@pc@reset@stackspace% \@pc@stackspace@forpseudocode% \ignorespacesafterend\noindent% } \newlength{\@pc@minipage@length} \newlength{\@pc@alt@minipage@length} \newlength{\@pc@length@tmp@width@vstack} \newcommand{\@withingame}{false} \newcommand{\@withinbxgame}{false} \newcommand{\@withingamedescription}{false} \newcommand{\@bxgameheader}{} \newlength\@pseudocodecodeminlineheight@len \newcommand{\@pc@beginnewline}{% \@pseudocodecodeatbeginline\@pseudocodelinenumber\@pc@and\@pcln@stephiddenlncnt% \setlength{\@pseudocodecodeminlineheight@len}{\@pseudocodecodeminlineheight}% \vphantom{\rule[0.5ex-0.5\@pseudocodecodeminlineheight@len]{0pt}{\@pseudocodecodeminlineheight@len}}% \ifthenelse{\equal{\@pseudocodespace}{auto}}% {\expandafter\pcind\expandafter[\value{@pc@indentationlevel}]}% {}% \setcounter{pccolumncounter}{2}% \@pc@modebegin} \newcommand{\@pc@and@wrap@start}{\@pc@beginnewline} \newcommand{\@pc@and@wrap@end}{\@pc@modeend&\@pseudocodecodeatendline} \newcommand{\@pc@and}{&} \newlength{\@pcindentwidth} \providecommand{\pcind}[1][1]{% \setlength{\@pcindentwidth}{\widthof{\ensuremath{\quad}}*#1}% \ensuremath{\mathmakebox[\@pcindentwidth]{}}} \newcommand{\pctabname}{>} \newcommand{\pcdbltabname}{<} \newcommand{\pcindentname}{t} \newcounter{pclinenumber} \newcounter{Hpclinenumber} \newcounter{@pclinenumber} \newcounter{H@pclinenumber} \newcounter{@pclinenumbertmp} \newcounter{pcgamecounter} \newcounter{Hpcgamecounter} \newcounter{pcrlinenumber} \newcounter{Hpcrlinenumber} \newcounter{@pcrlinenumbertmp} \renewcommand{\the@pclinenumber}{\thepclinenumber} \providecommand{\@pcln@stephiddenlncnt}{% \refstepcounter{@pclinenumber}% \stepcounter{H@pclinenumber}% } \providecommand{\pclnseparator}{:} \providecommand{\pcrlnseparator}{} \providecommand{\pclnspace}{1em} \providecommand{\pclnrspace}{0.5em} \providecommand\pclnstyle[1]{\text{\scriptsize#1}} \providecommand{\pcln}{% \ifthenelse{\equal{\@pc@skiplnmarker}{1}}{\ifmeasuring@\else\@pc@resetskipln{}\fi}{% \refstepcounter{pclinenumber}% \stepcounter{Hpclinenumber}% \ifthenelse{\value{pclinenumber}<10}{\hspace{1ex}}{}% \pclnstyle{\arabic{pclinenumber}}\pclnseparator\hspace{\pclnspace}% }}% \def\@pc@skiplnmarker{} \providecommand{\pcskipln}{\ifmeasuring@\else\global\def\@pc@skiplnmarker{1}\fi} \newcommand{\@pc@resetskipln}{\global\def\@pc@skiplnmarker{}} \define@key{pseudocode}{skipfirstln}[1]{\global\def\@pc@skiplnmarker{1}} \providecommand{\pclnr}{% \refstepcounter{pclinenumber}% \stepcounter{Hpclinenumber}% \hspace{\pclnrspace}\pcrlnseparator\pclnstyle{\arabic{pclinenumber}}} \providecommand{\pcrln}{ \refstepcounter{pcrlinenumber}% \stepcounter{Hpcrlinenumber}% \hspace{\pclnrspace}\pcrlnseparator\pclnstyle{\arabic{pcrlinenumber}}} \newcommand*\@pseudocodehead{} \newcommand*\@pseudocodewidth{} \newcommand*\@pseudocodexshift{0pt} \newcommand*\@pseudocodeyshift{0pt} \newcommand*\@pseudocodelinenumber{} \newcommand*\@pseudocodebeforeskip{0ex} \newcommand*\@pseudocodeafterskip{0ex} \newcommand*\@pseudocodelnstart{0} \newcommand*\@pseudocodelnstartright{0} \newcommand*\@pseudocodesyntaxhighlighting{} \newcommand*\@pseudocodenodraft{false} \newcommand*\@pseudocodecolspace{} % empty per default, use length, \newcommand*\@pseudocodeheadlinecmd{\hrule} \newlength\pcheadlinesep \setlength\pcheadlinesep{0pt} \newcommand*\@pseudocodeheadlinesep{0em} \define@key{pseudocode}{headlinesep}[0em]{\renewcommand*\@pseudocodeheadlinesep{#1}} \newlength\pcbodylinesep \setlength\pcbodylinesep{0.3\baselineskip} \newcommand*\@pseudocodebodylinesep{0em} \define@key{pseudocode}{bodylinesep}[0em]{\renewcommand*\@pseudocodebodylinesep{#1}} \newlength\@pseudocodeheadheight@len \newcommand{\@pc@headheightskip}{% \setlength{\@pseudocodeheadheight@len}{\@pseudocodeheadheight}% \vphantom{\rule[0.5ex-0.5\@pseudocodeheadheight@len]{0pt}{\@pseudocodeheadheight@len}}% } \newlength\pcheadheight \setlength{\pcheadheight}{3.25ex} \newcommand*\@pseudocodeheadheight{\pcheadheight} \define@key{pseudocode}{headheight}[0em]{\renewcommand*\@pseudocodeheadheight{#1}} \newcommand*\@pseudocodecolsep{0em} \newcommand*\@pseudocodeaddtolength{2pt} \newcommand*\@pseudocodecodeatbeginline{} \newcommand*\@pseudocodecodeatendline{} \newcommand*\@pseudocodecodejot{0em} \newcommand*\@pseudocodecodesize{\small} \newcommand*\@pseudocodesubcodesize{\footnotesize} \newcommand*\@pseudocodeminipagealign{t} \newcommand*\@pseudocodekeywordsindent{for ,foreach ,if ,repeat ,while } \newcommand*\@pseudocodekeywordsunindent{endfor,endforeach,fi,endif,until,endwhile} \newcommand*\@pseudocodekeywordsuninindent{else if ,elseif ,else } \newcommand*\@pseudocodekeywords{for,foreach,{return },return,{ do },{ in },new,if, null, true,{until },{ to }, false,{ then},repeat,else if,elseif,while,else,done} \newcommand*\@pseudocodeaddkeywords{} \newcommand*\@pseudocodealtkeywords{} \begin{@pc@withspaces} \global\def\@pseudocodekeywordsspace{for,endfor,foreach,endforeach,return,do,in,new,if,null,true,until,to,false,then,repeat,else if,elseif,while,endwhile,else,done,fi,endif} \end{@pc@withspaces} \define@key{pseudocode}{beginline}[]{\renewcommand*\@pseudocodecodeatbeginline{#1}} \define@key{pseudocode}{endline}[]{\renewcommand*\@pseudocodecodeatendline{#1}} \define@key{pseudocode}{jot}[0em]{\renewcommand*\@pseudocodecodejot{#1}} \define@key{pseudocode}{codesize}[\small]{\renewcommand*\@pseudocodecodesize{#1}} \define@key{pseudocode}{subcodesize}[\small]{\renewcommand*\@pseudocodesubcodesize{#1}} \define@key{pseudocode}{head}[]{\renewcommand*\@pseudocodehead{#1}} \define@key{pseudocode}{width}[]{\renewcommand*\@pseudocodewidth{#1}} \define@key{pseudocode}{valign}[t]{\renewcommand*\@pseudocodeminipagealign{#1}} \define@key{pseudocode}{xshift}[]{\renewcommand*\@pseudocodexshift{#1}} \define@key{pseudocode}{yshift}[]{\renewcommand*\@pseudocodeyshift{#1}} \define@key{pseudocode}{colspace}[]{\renewcommand*\@pseudocodecolspace{#1}} \define@key{pseudocode}{linenumbering}[on]{\ifthenelse{\equal{#1}{on}}{\renewcommand*\@pseudocodelinenumber{\pcln}}{\renewcommand*\@pseudocodelinenumber{}}} \define@key{pseudocode}{beforeskip}[]{\renewcommand*\@pseudocodebeforeskip{#1}} \define@key{pseudocode}{afterskip}[]{\renewcommand*\@pseudocodeafterskip{#1}} \define@key{pseudocode}{lnstart}[0]{\renewcommand*\@pseudocodelnstart{#1}} \define@key{pseudocode}{lnstartright}[0]{\renewcommand*\@pseudocodelnstartright{#1}} \define@key{pseudocode}{colsep}[0em]{\renewcommand*\@pseudocodecolsep{#1}} \define@key{pseudocode}{headlinecmd}[\hrule]{\renewcommand*\@pseudocodeheadlinecmd{#1}} \define@key{pseudocode}{addtolength}[2pt]{\renewcommand*\@pseudocodeaddtolength{#1}} \define@key{pseudocode}{nodraft}[true]{\renewcommand*\@pseudocodenodraft{#1}} \define@key{pseudocode}{keywords}[]{\renewcommand*\@pseudocodekeywords{#1}} \define@key{pseudocode}{keywordsindent}[]{\renewcommand*\@pseudocodekeywordsindent{#1}} \define@key{pseudocode}{keywordsunindent}[]{\renewcommand*\@pseudocodekeywordsunindent{#1}} \define@key{pseudocode}{keywordsuninindent}[]{\renewcommand*\@pseudocodekeywordsuninindent{#1}} \define@key{pseudocode}{addkeywords}[]{\renewcommand*\@pseudocodeaddkeywords{#1}} \define@key{pseudocode}{altkeywords}[]{\renewcommand*\@pseudocodealtkeywords{#1}} \define@key{pseudocode}{syntaxhighlight}[]{\renewcommand*\@pseudocodesyntaxhighlighting{#1}} \newcommand{\@pc@modebegin}{} \newcommand{\@pc@modeend}{} \define@key{pseudocode}{mode}[math]{% \ifthenelse{\equal{#1}{text}}{% \renewcommand*\@pc@modebegin{\begin{varwidth}{\textwidth}% \let\@pc@lb\\% \renewcommandx*{\\}[2][1=,2=]{\@pc@modeend\@pc@and \@pseudocodecodeatendline\ifthenelse{\equal{####1}{}}{\@pc@lb}{\@pc@lb[####1]}####2 \@pc@beginnewline}% \def\pclb{\let\\\@pc@lb\relax\@pc@modeend\\}% \def\pcolb{\let\\\@pc@lb\relax\@pc@modeend\\}% }% \renewcommand*\@pc@modeend{\end{varwidth}}% }{\renewcommand{\@pc@modebegin}{}\renewcommand{\@pc@modeend}{}}} \providecommand{\pcminlineheight}{0pt} \newcommand*\@pseudocodecodeminlineheight{\pcminlineheight} \define@key{pseudocode}{minlineheight}[0pt]{\renewcommand*\@pseudocodecodeminlineheight{#1}} \ExplSyntaxOn \tl_new:N \l_pc_strsub_input_tl \tl_new:N \l_pc_strsub_search_tl \tl_new:N \l_pc_strsub_replace_tl \NewDocumentCommand{\@pc@stringsubstitution}{mmm} { \tl_set:Nn \l_pc_strsub_input_tl { #1 } \tl_set:Nn \l_pc_strsub_search_tl { #2 } \tl_set:Nn \l_pc_strsub_replace_tl { #3 } % \tl_show_analysis:N \l_pc_strsub_input_tl % uncomment for debugging % \tl_show_analysis:N \l_pc_strsub_search_tl % uncomment for debugging % \tl_show_analysis:N \l_pc_strsub_replace_tl % uncomment for debugging \regex_replace_all:nnN { \u{l_pc_strsub_search_tl} } %only match if keyword does not have a word character preceding { \u{l_pc_strsub_replace_tl} } \l_pc_strsub_input_tl % \tl_show_analysis:N \l_tmpa_tl % uncomment for debugging \tl_use:N \l_pc_strsub_input_tl } \ExplSyntaxOff \newcommand{\@pc@syntaxhighlight}[1]{% \ifmeasuring@#1\else% \ifthenelse{\equal{\@pseudocodesyntaxhighlighting}{auto}}{% \def\@shtmp{#1}% first step \ifthenelse{\equal{\@pseudocodespace}{keep}} {\edef\@tmpkeywords{\@pseudocodekeywordsspace,\@pseudocodeaddkeywords}} {\ifthenelse{\equal{\@pseudocodespace}{auto}} {\edef\@tmpkeywords{\@pseudocodekeywords,\@pseudocodeaddkeywords}} {\edef\@tmpkeywords{\@pseudocodekeywords,\@pseudocodekeywordsindent,\@pseudocodekeywordsunindent,\@pseudocodekeywordsuninindent,\@pseudocodeaddkeywords}}} \foreach \@pckw in \@tmpkeywords{% \ifthenelse{\equal{\@pckw}{}}{}{% \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \gdef\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@shtmp\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@pc@stringsubstitution\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\@shtmp\expandafter\expandafter\expandafter }\expandafter\expandafter\expandafter{\expandafter\@pckw\expandafter}\expandafter{\expandafter\@pc@highlight\expandafter{\@pckw}}}% }}% alt keywords \foreach \@pckw in \@pseudocodealtkeywords{% \ifthenelse{\equal{\@pckw}{}}{}{% \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \gdef\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@shtmp\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@pc@stringsubstitution\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\@shtmp\expandafter\expandafter\expandafter }\expandafter\expandafter\expandafter{\expandafter\@pckw\expandafter}\expandafter{\expandafter\@pc@althighlight\expandafter{\@pckw}}}% }}% \ifthenelse{\equal{\@pseudocodespace}{auto}} {% \foreach \@pckw in \@pseudocodekeywordsindent{% indentation keywords \ifthenelse{\equal{\@pckw}{}}{}{% \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \gdef\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@shtmp\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@pc@stringsubstitution\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\@shtmp\expandafter\expandafter\expandafter }\expandafter\expandafter\expandafter{\expandafter\@pckw\expandafter}\expandafter{\expandafter\@pc@highlightindent\expandafter{\@pckw}}}% }}% \foreach \@pckw in \@pseudocodekeywordsunindent{% unindentation keywords \ifthenelse{\equal{\@pckw}{}}{}{% \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \gdef\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@shtmp\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@pc@stringsubstitution\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\@shtmp\expandafter\expandafter\expandafter }\expandafter\expandafter\expandafter{\expandafter\@pckw\expandafter}\expandafter{\expandafter\@pc@highlightunindent\expandafter{\@pckw}}}% }}% \foreach \@pckw in \@pseudocodekeywordsuninindent{% uninindentation keywords \ifthenelse{\equal{\@pckw}{}}{}{% \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \gdef\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@shtmp\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter \@pc@stringsubstitution\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter {\expandafter\expandafter\expandafter\@shtmp\expandafter\expandafter\expandafter }\expandafter\expandafter\expandafter{\expandafter\@pckw\expandafter}\expandafter{\expandafter\@pc@highlightuninindent\expandafter{\@pckw}}}% }}% }{}% \@shtmp% }{#1}% nothing to highlight \fi} \newcommand{\@pc@highlight}[1]{% \ifthenelse{\equal{\@pseudocodespace}{keep}} {\highlightkeyword[]{#1}}% {\highlightkeyword[]{\@pc@stringsubstitution{#1}{ }{~}}}% } \newcommand{\@pc@highlightindent}[1]{% \@pc@increaseindent\@pc@highlight{#1}% } \newcommand{\@pc@highlightunindent}[1]{% \@pc@decreaseindent\@pc@highlight{#1}% } \newcommand{\@pc@highlightuninindent}[1]{% \@pc@tmpdecreaseindent\@pc@highlight{#1}% } \newcommand{\@pc@althighlight}[1]{% \ifthenelse{\equal{\@pseudocodespace}{keep}} {\highlightaltkeyword{#1}}% {\highlightaltkeyword{\@pc@stringsubstitution{#1}{ }{~}}}% } \newcommand{\@pc@thecontent}{} \newcommand{\@pc@colspace}{} \newcommand{\@withinspaces}{false}% \newcommand{\@keepspaces}{% \renewcommand{\@withinspaces}{true}\@pc@withspaces% } \newcommand*\@pseudocodespace{} \define@key{pcspace}{space}[]{\ifthenelse{\equal{#1}{keep}}{\@keepspaces}{}\renewcommand*\@pseudocodespace{#1}} \newcommand*\@pc@defaultargs{} \newcommand*\pcsetargs[1]{\renewcommand*\@pc@defaultargs{#1}} \newcounter{@pc@indentationlevel} \newcommand{\@pc@increaseindent}{\addtocounter{@pc@indentationlevel}{1}} \newcommand{\@pc@decreaseindent}{\ifthenelse{\equal{\@pseudocodespace}{auto}}{\pcind[-1]}{}\addtocounter{@pc@indentationlevel}{-1}} \newcommand{\@pc@tmpdecreaseindent}{\ifthenelse{\equal{\@pseudocodespace}{auto}}{\pcind[-1]}{}} \newcounter{pccolumncounter} \setcounter{pccolumncounter}{2} \let\@pc@halign\halign% \providecommand{\pseudocode}{% \begingroup% \renewcommand{\@withinspaces}{false}% \@ifnextchar[%] {\@pseudocodeA}% {\@pseudocode[]}% } \def\@pseudocodeA[#1]{% \setkeys*{pcspace}{#1}%test if there is a space assignment within the keys .. make the necessary arrangements and call the actual method \@pseudocode[#1]% } \def\@pseudocode[#1]#2{% \begingroup% \@pc@resetskipln% \@expandedsetkeys{pseudocode}{space}{head=}{\@pc@defaultargs}{#1}% \@pc@ifdraft{\ifthenelse{\equal{\@pseudocodenodraft}{true}}{}{\renewcommand\@pseudocodesyntaxhighlighting{}}}{}% \addtocounter{@pc@global@pc@nestcnt}{1}% \@pc@ensureremember% \ifcsname \pctabname\endcsname% \expandafter\renewcommand\csname \pctabname\endcsname{\@pc@modeend&\@pc@colspace\@pc@modebegin}% \else% \expandafter\newcommand\csname \pctabname\endcsname{\@pc@modeend&\@pc@colspace\@pc@modebegin}% \fi% \ifcsname \pcdbltabname\endcsname% \expandafter\renewcommand\csname \pcdbltabname\endcsname{\@pc@modeend&&\@pc@colspace\@pc@modebegin}% \else% \expandafter\newcommand\csname \pcdbltabname\endcsname{\@pc@modeend&&\@pc@colspace\@pc@modebegin}% \fi% \ifthenelse{\equal{\@pseudocodecolspace}{}} {} {\renewcommand{\@pc@colspace}{\hspace{\@pseudocodecolspace}}}% \addtolength{\jot}{\@pseudocodecodejot}% \expandafter\let\csname \pcindentname\endcsname\pcind% \renewcommand{\@pc@thecontent}{\@pc@and@wrap@start\@pc@syntaxhighlight{#2}\@pc@and@wrap@end}% \stepcounter{@pc@global@pc@cnt}% \setcounter{pclinenumber}{\@pseudocodelnstart}% \setcounter{pcrlinenumber}{\@pseudocodelnstartright}% \setlength{\@pc@minipage@length}{0pt}% \setlength{\@pc@alt@minipage@length}{0pt}% \setcounter{@pclinenumbertmp}{\value{pclinenumber}}% \setcounter{@pcrlinenumbertmp}{\value{pcrlinenumber}}% \setcounter{pccolumncounter}{2}% \vspace{\@pseudocodeyshift}% \ifthenelse{\value{@pc@global@pc@nestcnt}=1}{% \let\@pc@halign\halign% \newenvironment{pcmbox}{\let\halign\@pc@halign}{}% \def\halign{% \renewcommand{\label}[1]{\ifmeasuring@\else\@pc@original@label{####1}\fi}% \let\@pc@lb\\% \renewcommandx*{\\}[2][1=,2=]{\@pc@modeend\@pc@and\@pseudocodecodeatendline \ifthenelse{\equal{####1}{}}{\@pc@lb}{\@pc@lb[####1]}####2 \@pc@beginnewline}% \def\pclb{\let\\\@pc@lb\relax\@pc@modeend\\}% \@pc@halign}% }{}% \renewcommand*{\minalignsep}{\@pseudocodecolsep}% \edef\@pc@org@skiplnmarker{\@pc@skiplnmarker}% \ifthenelse{\equal{\@pseudocodewidth}{}}{% \ifthenelse{\value{@pcsubprogstep}=0}{% \@pc@settowidthofalign{\@pc@minipage@length}{\@pc@thecontent}% }{% \@pc@settowidthofaligned{\@pc@minipage@length}{\@pc@thecontent}% }% \ifthenelse{\equal{\@withingame}{true}}% {\ifthenelse{\equal{\@pc@secondheader}{true}}% {\addtolength{\@pc@alt@minipage@length}{\widthof{x\ensuremath{\@pc@gametitle[1]\@pc@gametitle[1]}}}} {\addtolength{\@pc@alt@minipage@length}{\widthof{\ensuremath{\@pc@gametitle[1]}}}}}% {\addtolength{\@pc@alt@minipage@length}{\widthof{\@pseudocodehead}}}% \ifdim\@pc@alt@minipage@length>\@pc@minipage@length% \setlength{\@pc@minipage@length}{\@pc@alt@minipage@length}% \fi% \addtolength{\@pc@minipage@length}{\@pseudocodeaddtolength}% }{\addtolength{\@pc@minipage@length}{\@pseudocodewidth}}% \setcounter{pclinenumber}{\value{@pclinenumbertmp}}% \setcounter{pcrlinenumber}{\value{@pcrlinenumbertmp}}% \setcounter{@pc@indentationlevel}{0}% \edef\@pc@skiplnmarker{\@pc@org@skiplnmarker}% \hspace{\pcbeforeskip}\hspace{\@pseudocodexshift}% \ifthenelse{\equal{\@pseudocodeminipagealign}{t}}{% \raisebox{\dimexpr\ht\strutbox-\height}{\@pc@pseudocodeminipage{t}}% }{% \@pc@pseudocodeminipage{\@pseudocodeminipagealign}% }% \hspace{\pcafterskip}% \@pc@releaseremember% \addtocounter{@pc@global@pc@nestcnt}{-1}% \endgroup% \ifthenelse{\equal{\@withinspaces}{true}}{\end@pc@withspaces}{}% \endgroup% \@pc@stackspace@forpseudocode% } \newcommand{\@pc@pseudocodeminipage}[1]{% \begin{minipage}[#1]{\@pc@minipage@length}% \ifthenelse{\value{@pcsubprogstep}=0}{% \pc@display@pseudocode{\@pseudocodehead}{\@pc@thecontent}% }{% if sub procedure \pc@display@subcode{\@pseudocodehead}{\@pc@thecontent}% }% \end{minipage}% } \newcommand{\@pc@display@gameheader}[1]{% \tikz{\gdef\i{\thepcgamecounter}% \node[anchor=base,text depth=0pt, inner sep=0.05em,outer sep=0pt] (gamenode\i) {#1}; \ifthenelse{\equal{\@withinbxgame}{true}} {\node[draw,anchor=base, above=2ex of gamenode\i] (bgamenode\i) {\@bxgameheader};} {}% }% } \let\pclb\relax \newcommand{\pc@display@pseudocode}[2]{% \ifthenelse{\equal{#1}{}}{\vspace{-\baselineskip}\@pseudocodecodesize{}}{% \ifthenelse{\equal{\@withingame}{true}} {\ifthenelse{\equal{\@pc@secondheader}{true}} {\@pc@display@gameheader{#1}\addtocounter{pcgamecounter}{1}\fboxsep=1pt\fbox{\vphantom{#1}\@pc@display@gameheader{#1}}} {\@pc@display@gameheader{#1}}} {#1}% \@pc@headheightskip\vspace{\pcheadlinesep}\vspace{\@pseudocodeheadlinesep}\@pseudocodeheadlinecmd% \vspace{-\baselineskip}\vspace{\pcbodylinesep}\vspace{\@pseudocodebodylinesep}\@pseudocodecodesize}% \begin{flalign*}#2\end{flalign*}% } \newcommand{\pc@display@subcode}[2]{% \begingroup% \ifthenelse{\equal{#1}{}}{}{#1\@pc@headheightskip% \vspace{\pcheadlinesep}\vspace{\@pseudocodeheadlinesep}\@pseudocodeheadlinecmd{}% \vspace{\pcbodylinesep}\vspace{\@pseudocodebodylinesep}}% \@pseudocodesubcodesize% $\begin{aligned}#2\end{aligned}$% \endgroup% } \newcommand{\@pc@gettikzwidth}[2]{ % #1 = width, #2 = height \pgfextractx{\@tempdima}{\pgfpointdiff{\pgfpointanchor{current bounding box}{south west}} {\pgfpointanchor{current bounding box}{north east}}} \global#1=\@tempdima \pgfextracty{\@tempdima}{\pgfpointdiff{\pgfpointanchor{current bounding box}{south west}} {\pgfpointanchor{current bounding box}{north east}}} \global#2=\@tempdima } \def\@pseudocodeB#1#2[#3]#4{\setkeys*{pcspace}{#2,#3}\@pseudocode[head={#1#4},#2,#3]} \def\@pseudocodeC#1#2#3{\setkeys*{pcspace}{#2}\@pseudocode[head={#1#3},#2]} \def\@pseudocodeE#1#2[#3]{\setkeys*{pcspace}{#2,#3}\@pseudocode[head={#1},#2,#3]} \def\@pseudocodeF#1#2{\setkeys*{pcspace}{#2}\@pseudocode[head={#1},#2]} \newcommand*{\@pc@createproc@headmode}{text} \newcommand{\createprocedurecommand}[4]{ \expandafter\gdef\csname #1\endcsname{% \begingroup% \renewcommand{\@withinspaces}{false}% #2% \@ifnextchar[%] {\@pseudocodeB{#3}{#4}} {\@pseudocodeC{#3}{#4}}% }% } \newcommand{\createpseudocodecommand}[4]{ \expandafter\gdef\csname #1\endcsname{% \begingroup% \renewcommand{\@withinspaces}{false}% #2% \@ifnextchar[%] {\@pseudocodeE{#3}{#4}} {\@pseudocodeF{#3}{#4}}% }% } \newcommand{\createpseudocodeblock}[5]{ \createpseudocodecommand{#1@pc}{#3}{#4}{#5} \expandafter\gdef\csname #1\endcsname{% \@ifnextchar[%] {\csname #1@@\endcsname} {\csname #1@\endcsname} }% \expandafter\gdef\csname #1@\endcsname##1{% \begin{pchstack}[#2] \csname #1@pc\endcsname{##1} \end{pchstack} } \expandafter\gdef\csname #1@@\endcsname[##1]##2{% \begin{pchstack}[#2] \csname #1@pc\endcsname[##1]{##2} \end{pchstack} } } \newcommand{\createprocedureblock}[5]{ \createprocedurecommand{#1@pc}{#3}{#4}{#5} \expandafter\gdef\csname #1\endcsname{% \@ifnextchar[%] {\csname #1@@\endcsname} {\csname #1@\endcsname} }% \expandafter\gdef\csname #1@\endcsname##1##2{% \begin{pchstack}[#2] \csname #1@pc\endcsname{##1}{##2} \end{pchstack} } \expandafter\gdef\csname #1@@\endcsname[##1]##2##3{% \begin{pchstack}[#2] \csname #1@pc\endcsname[##1]{##2}{##3} \end{pchstack} } } \createprocedurecommand{procedure}{}{}{} \createpseudocodeblock{pseudocodeblock}{center}{}{}{} \createprocedureblock{procedureblock}{center}{}{}{} \newcounter{@pcsubprogcnt1} \newcounter{@pcrsubprogcnt1} \newcounter{@pcsubprogcnt2} \newcounter{@pcrsubprogcnt2} \newcounter{@pcsubprogcnt3} \newcounter{@pcrsubprogcnt3} \newcounter{@pcsubprogcnt4} \newcounter{@pcrsubprogcnt4} \newcounter{@pcsubprogcnt5} \newcounter{@pcrsubprogcnt5} \newcounter{@pcsubprogcnt6} \newcounter{@pcrsubprogcnt6} \newcounter{@pcsubprogcnt7} \newcounter{@pcrsubprogcnt7} \newcounter{@pcsubprogcnt8} \newcounter{@pcrsubprogcnt8} \newcounter{@pcsubprogcnt9} \newcounter{@pcrsubprogcnt9} \newcounter{@pcsubprogstep} \newenvironment{subprocedure}{% \addtocounter{@pcsubprogstep}{1}% \setcounter{@pcsubprogcnt\the@pcsubprogstep}{\value{pclinenumber}}% \setcounter{@pcrsubprogcnt\the@pcsubprogstep}{\value{pcrlinenumber}}% }{% \setcounter{pclinenumber}{\value{@pcsubprogcnt\the@pcsubprogstep}}% \setcounter{pcrlinenumber}{\value{@pcrsubprogcnt\the@pcsubprogstep}}% \addtocounter{@pcsubprogstep}{-1}} \newcommand{\pcshortmessageoffset}{0.5cm} \newcommand{\pcdefaultmessagelength}{3.5cm} \newcommand{\pcdefaultlongmessagelength}{6cm} \newcommand{\pcbeforemessageskip}{0pt} \newcommand{\pcaftermessageskip}{10pt} \newlength{\pcmessagearrow} \newcommand*\@pcsendmessagelength{\pcdefaultmessagelength} \newcommand*\@pcsendmessagecol{} \newcommand*\@pcsendmessagewidth{} \newcommand*\@pcsendmessagestyle{} \newcommand*\@pcsendmessagetop{} \newcommand*\@pcsendmessagebottom{} \newcommand*\@pcsendmessageright{} \newcommand*\@pcsendmessageleft{} \newcommand*\@pcsendmessagetopname{t} \newcommand*\@pcsendmessagebottomname{b} \newcommand*\@pcsendmessagerightname{r} \newcommand*\@pcsendmessageleftname{l} \newcommand*\@pcsendmessagetopstyle{} \newcommand*\@pcsendmessagebottomstyle{} \newcommand*\@pcsendmessagerightstyle{} \newcommand*\@pcsendmessageleftstyle{} \newcommand*\@pcsendmessagebeforeskip{\pcbeforemessageskip} \newcommand*\@pcsendmessageafterskip{\pcaftermessageskip} \define@key{pcsendmessage}{centercol}[]{\renewcommand*\@pcsendmessagecol{#1}} \define@key{pcsendmessage}{width}[]{\renewcommand*\@pcsendmessagewidth{#1}} \define@key{pcsendmessage}{style}[]{\renewcommand*\@pcsendmessagestyle{#1}} \define@key{pcsendmessage}{length}[]{\renewcommand*\@pcsendmessagelength{#1}} \define@key{pcsendmessage}{top}[]{\renewcommand*\@pcsendmessagetop{#1}} \define@key{pcsendmessage}{bottom}[]{\renewcommand*\@pcsendmessagebottom{#1}} \define@key{pcsendmessage}{right}[]{\renewcommand*\@pcsendmessageright{#1}} \define@key{pcsendmessage}{left}[]{\renewcommand*\@pcsendmessageleft{#1}} \define@key{pcsendmessage}{topname}[]{\renewcommand*\@pcsendmessagetopname{#1}} \define@key{pcsendmessage}{bottomname}[]{\renewcommand*\@pcsendmessagebottomname{#1}} \define@key{pcsendmessage}{rightname}[]{\renewcommand*\@pcsendmessagerightname{#1}} \define@key{pcsendmessage}{leftname}[]{\renewcommand*\@pcsendmessageleftname{#1}} \define@key{pcsendmessage}{topstyle}[]{\renewcommand*\@pcsendmessagetopstyle{#1}} \define@key{pcsendmessage}{bottomstyle}[]{\renewcommand*\@pcsendmessagebottomstyle{#1}} \define@key{pcsendmessage}{rightstyle}[]{\renewcommand*\@pcsendmessagerightstyle{#1}} \define@key{pcsendmessage}{leftstyle}[]{\renewcommand*\@pcsendmessageleftstyle{#1}} \define@key{pcsendmessage}{beforeskip}[]{\renewcommand*\@pcsendmessagebeforeskip{#1}} \define@key{pcsendmessage}{afterskip}[]{\renewcommand*\@pcsendmessageafterskip{#1}} \newcommand*\@pcsendmessagealignedtop{false} \define@key{pcsendmessage}{topaligned}[true]{\renewcommand*\@pcsendmessagealignedtop{#1}} \newcommand*\@pcsendmessagealignedbottom{false} \define@key{pcsendmessage}{bottomaligned}[true]{\renewcommand*\@pcsendmessagealignedbottom{#1}} \newcommand*\@pcsendmessagealignedleft{false} \define@key{pcsendmessage}{leftaligned}[true]{\renewcommand*\@pcsendmessagealignedleft{#1}} \newcommand*\@pcsendmessagealignedright{false} \define@key{pcsendmessage}{rightaligned}[true]{\renewcommand*\@pcsendmessagealignedright{#1}} \newcommand{\@pc@centerincol}[2]{% \ifmeasuring@% #2% \else% \makebox[\ifcase\expandafter #1\maxcolumn@widths\fi]{$\displaystyle#2$}% \fi% } \newcommand{\centerincol}[1]{\@pc@centerincol{\thepccolumncounter}{#1}} \newcommand{\@do@sendmessage}[1]{% \ifthenelse{\equal{\@pcsendmessagecol}{}}{% \ifthenelse{\equal{\@pcsendmessagewidth}{}}{#1}{% we have some width \makebox[\@pcsendmessagewidth]{$\displaystyle#1$}% }}{%we know the column to center on \@pc@centerincol{\@pcsendmessagecol}{#1}% }% } \newcommand*{\sendmessage}[2]{% \begingroup\setkeys{pcsendmessage}{#2}% \tikzset{PCSENDMSG-PATH-STYLE/.style/.expand once=\@pcsendmessagestyle}% \tikzset{PCSENDMSG-TOP-STYLE/.style/.expand once=\@pcsendmessagetopstyle}% \tikzset{PCSENDMSG-BOTTOM-STYLE/.style/.expand once=\@pcsendmessagebottomstyle}% \tikzset{PCSENDMSG-LEFT-STYLE/.style/.expand once=\@pcsendmessageleftstyle}% \tikzset{PCSENDMSG-RIGHT-STYLE/.style/.expand once=\@pcsendmessagerightstyle}% \ifthenelse{\equal{\@pcsendmessagealignedtop}{true}} {\ifthenelse{\equal{\@pcsendmessagetop}{}} {\let\@pc@fin@sendmessagetop\@pcsendmessagetop}% {\newcommand{\@pc@fin@sendmessagetop}{\let\halign\@pc@halign$\begin{aligned}\@pcsendmessagetop\end{aligned}$}}} {\let\@pc@fin@sendmessagetop\@pcsendmessagetop}% \ifthenelse{\equal{\@pcsendmessagealignedbottom}{true}} {\ifthenelse{\equal{\@pcsendmessagebottom}{}} {\let\@pc@fin@sendmessagebottom\@pcsendmessagebottom}% {\newcommand{\@pc@fin@sendmessagebottom}{\let\halign\@pc@halign$\begin{aligned}\@pcsendmessagebottom\end{aligned}$}}} {\let\@pc@fin@sendmessagebottom\@pcsendmessagebottom}% \ifthenelse{\equal{\@pcsendmessagealignedright}{true}} {\ifthenelse{\equal{\@pcsendmessageright}{}} {\let\@pc@fin@sendmessageright\@pcsendmessageright} {\newcommand{\@pc@finsendmessageright}{\let\halign\@pc@halign$\begin{aligned}\@pcsendmessageright\end{aligned}$}}} {\let\@pc@fin@sendmessageright\@pcsendmessageright}% \ifthenelse{\equal{\@pcsendmessagealignedleft}{true}} {\ifthenelse{\equal{\@pcsendmessageleft}{}} {\let\@pc@fin@sendmessageleft\@pcsendmessageleft} {\newcommand{\@pc@fin@sendmessageleft}{\let\halign\@pc@halign$\begin{aligned}\@pcsendmessageleft\end{aligned}$}}} {\let\@pc@fin@sendmessageleft\@pcsendmessageleft}% \addtocounter{@pcsubprogstep}{1}% \hspace{\@pcsendmessagebeforeskip}% \begin{varwidth}{\linewidth} \@do@sendmessage{ \begin{tikzpicture}% \node[PCSENDMSG-LEFT-STYLE] (\@pcsendmessageleftname) {\@pc@fin@sendmessageleft}; \node[right=\@pcsendmessagelength of \@pcsendmessageleftname,PCSENDMSG-RIGHT-STYLE] (\@pcsendmessagerightname) {\@pc@fin@sendmessageright}; \path[#1,PCSENDMSG-PATH-STYLE] (\@pcsendmessageleftname) edge[] node[above,PCSENDMSG-TOP-STYLE] (\@pcsendmessagetopname) {\@pc@fin@sendmessagetop} node[below,PCSENDMSG-BOTTOM-STYLE] (\@pcsendmessagebottomname) {\@pc@fin@sendmessagebottom} (\@pcsendmessagerightname); \end{tikzpicture}% }% \end{varwidth} \addtocounter{@pcsubprogstep}{-1}% \hspace{\@pcsendmessageafterskip}% \endgroup% } \WithSuffix\newcommand\sendmessage*[2]{% \sendmessage{#1}{topaligned,leftaligned,bottomaligned,rightaligned,#2}% } \newcommandx*{\sendmessageright}[2][1=->]{% \sendmessage{#1}{#2}% } \newcommandx*{\sendmessageleft}[2][1=<-]{% \sendmessage{#1}{#2}% } \WithSuffix\newcommand\sendmessageleft*[2][\pcdefaultmessagelength]{% \begingroup% \renewcommand{\@pcsendmessagetop}{\let\halign\@pc@halign$\begin{aligned}#2\end{aligned}$}% \sendmessage{<-}{length=#1}% \endgroup% } \WithSuffix\newcommand\sendmessageright*[2][\pcdefaultmessagelength]{% \begingroup% \renewcommand{\@pcsendmessagetop}{\let\halign\@pc@halign$\begin{aligned}#2\end{aligned}$}% \sendmessage{->}{length=#1}% \endgroup% } \WithSuffix\newcommand\sendmessagerightleft*[2][\pcdefaultmessagelength]{% \begingroup% \renewcommand{\@pcsendmessagetop}{\let\halign\@pc@halign$\begin{aligned}#2\end{aligned}$}% \sendmessage{<->}{length=#1}% \endgroup% } \DeclareExpandableDocumentCommand{\sendmessagerightx}{O{\pcdefaultlongmessagelength}mO{}m}{% \multicolumn{#2}{c}{\ensuremath{\hspace{\pcbeforemessageskip}\xrightarrow[\begin{aligned}#3\end{aligned}]{\mathmakebox[#1]{\begin{aligned}#4\end{aligned}}}\hspace{\pcaftermessageskip}}} } \DeclareExpandableDocumentCommand{\sendmessageleftx}{O{\pcdefaultlongmessagelength}mO{}m}{% \multicolumn{#2}{c}{\ensuremath{\hspace{\pcbeforemessageskip}\xleftarrow[\begin{aligned}#3\end{aligned}]{\mathmakebox[#1]{\begin{aligned}#4\end{aligned}}}\hspace{\pcaftermessageskip}}} } \DeclareExpandableDocumentCommand{\pcintertext}{O{}m}{\intertext{% \ifthenelse{\equal{#1}{center}}{\makebox[\linewidth][c]{#2}}{}% \ifthenelse{\equal{#1}{dotted}}{\dotfill#2\dotfill}{}% \ifthenelse{\equal{#1}{}}{#2}{}% }\@pc@beginnewline} \newcounter{@pc@remember} \newcommand{\@pc@ensureremember}{% \ifthenelse{\value{@pc@remember}=0}{\tikzstyle{every picture}+=[remember picture]}{}% \addtocounter{@pc@remember}{1}} \newcommand{\@pc@releaseremember}{% \addtocounter{@pc@remember}{-1}% \ifthenelse{\value{@pc@remember}=0}{\tikzstyle{every picture}-=[remember picture]}{}% } \newenvironment{pcimage}{% \begingroup\@pc@ensureremember% }{% \@pc@releaseremember\endgroup% } \newcommand*\@pcnodecontent{} \newcommand*\@pcnodestyle{} \newcommand*\@pcnodedraw{} \define@key{pcnode}{content}[]{\renewcommand*\@pcnodecontent{#1}} \define@key{pcnode}{style}[]{\renewcommand*\@pcnodestyle{#1}} \define@key{pcnode}{draw}[]{\renewcommand*\@pcnodedraw{#1}} \newcommandx*{\pcnode}[2][2=]{% \begingroup\setkeys{pcnode}{#2}% \tikzset{PCNODE-STYLE/.style/.expand once=\@pcnodestyle}% \begin{tikzpicture}[inner sep=0ex,baseline=0pt]% \node[PCNODE-STYLE] (#1) {\@pcnodecontent}; % \end{tikzpicture}% \ifdefempty{\@pcnodedraw}{}{% \begin{tikzpicture}[overlay,inner sep=0ex,baseline=0pt]\@pcnodedraw\end{tikzpicture} }% \endgroup} \newcommandx*{\pcdraw}[2][2=]{% \begin{tikzpicture}[overlay,inner sep=0ex,baseline=0pt,#2] #1 \end{tikzpicture}} \newcommand{\@bb@lastbox}{} \newcommand{\@bb@lastoracle}{} \newcommand{\@bb@lastchallenger}{} \newlength{\@bb@message@voffset} \newlength{\@bb@query@voffset} \newlength{\@bb@oraclequery@voffset} \newlength{\@bb@challengerquery@voffset} \newcounter{@bb@oracle@cnt} \newcounter{@bb@oracle@nestcnt} \newcounter{@bb@challenger@cnt} \newcounter{@bb@challenger@nestcnt} \newcounter{@bb@env@nestcnt} \newcommand{\bbroraclenodenameprefix}{ora-} \newcommand{\bbrchallengernodenameprefix}{challenger-} \newcommand{\bbrenvnodenameprefix}{env-} \newcommand*\@pc@bbrenvaboveskip{0pt} \define@key{pcbbrenv}{aboveskip}[0pt]{\renewcommand*\@pc@bbrenvaboveskip{#1}} \newcommand*\@pc@bbrenvbelowskip{0pt} \define@key{pcbbrenv}{belowskip}[0pt]{\renewcommand*\@pc@bbrenvbelowskip{#1}} \newcommand*\@pc@bbrenv@argstring{} \def\@pc@bbrenv@remfinalequals#1=#2=\relax{\renewcommand*\@pc@bbrenv@argstring{#1=#2}} \def\@pc@bbrenv@legacyargcheck#1=#2\relax{% \ifthenelse{\equal{#2}{}} {\PackageWarning{cryptocode}{Deprecated option for bbrenv. Please use key value list as first parameter with keys aboveskip and/or belowskip.}% \renewcommand*\@pc@bbrenv@argstring{aboveskip=#1}} {\@pc@bbrenv@remfinalequals#1=#2\relax}% } \providecommand{\bbrfirstmessageoffset}{1ex} \newenvironmentx{bbrenv}[3][1={aboveskip=0pt,belowskip=0pt},3=0pt]{% \addtocounter{@bb@env@nestcnt}{1}% \renewcommand{\@bb@lastbox}{#2}% \@pc@bbrenv@legacyargcheck#1=\relax% \@expandedsetkeys{pcbbrenv}{}{belowskip=#3}{\@pc@bbrenv@argstring}{}% \@pc@globalsetlength{\@bb@message@voffset}{\bbrfirstmessageoffset}% \@pc@globalsetlength{\@bb@query@voffset}{\bbrfirstmessageoffset}% \@pc@globalsetlength{\@bb@oraclequery@voffset}{\bbrfirstmessageoffset}% \@pc@globalsetlength{\@bb@challengerquery@voffset}{\bbrfirstmessageoffset}% \ifthenelse{\value{@bb@oracle@nestcnt}=0} {\setcounter{@bb@oracle@cnt}{0}}{}% \ifthenelse{\value{@bb@challenger@nestcnt}=0} {\setcounter{@bb@challenger@cnt}{0}}{}% \vspace{\@pc@bbrenvaboveskip}% \ifthenelse{\value{@bb@env@nestcnt}=1} {\@pc@ensureremember% \begin{tikzpicture} }{\tikz\bgroup} }{% \ifthenelse{\value{@bb@env@nestcnt}=1} {\end{tikzpicture}% \@pc@releaseremember% }{\egroup}% \vspace{\@pc@bbrenvbelowskip}% \addtocounter{@bb@env@nestcnt}{-1}% \@pc@globalsetlength{\@bb@message@voffset}{\bbrfirstmessageoffset}% \@pc@globalsetlength{\@bb@query@voffset}{\bbrfirstmessageoffset}% \@pc@globalsetlength{\@bb@oraclequery@voffset}{\bbrfirstmessageoffset}% \@pc@globalsetlength{\@bb@challengerquery@voffset}{\bbrfirstmessageoffset}% } \newcommand*\bbrboxname{} \newcommand*\bbrboxnamepos{right} \newcommand*\bbrboxnamestyle{} \newcommand*\@bbrboxnamepos{below right=0.5ex and -0.5ex of \@bb@lastbox.north east,anchor=north east} \newcommand*\bbrboxabovesep{\baselineskip} \newcommand*\@bbrboxnameposoffset{below left=\bbrboxabovesep of phantomname.south west} \newcommand*\bbrboxstyle{draw} \newcommand*\bbrboxafterskip{} \newcommand*\bbrboxminheight{0cm} \newcommand*\bbrboxminwidth{2cm} \newcommand*\bbrboxxshift{0cm} \newcommand*\bbrboxyshift{0cm} \define@key{bbrbox}{abovesep}[]{\renewcommand*\bbrboxabovesep{#1}} \define@key{bbrbox}{name}[]{\renewcommand*\bbrboxname{#1}} \define@key{bbrbox}{namestyle}[]{\renewcommand*\bbrboxnamestyle{#1}} \define@key{bbrbox}{namepos}[]{\renewcommand*\bbrboxnamepos{#1}} \define@key{bbrbox}{style}[draw]{\renewcommand*\bbrboxstyle{#1}} \define@key{bbrbox}{minwidth}[]{\renewcommand*\bbrboxminwidth{#1}} \define@key{bbrbox}{addheight}[]{\renewcommand*\bbrboxafterskip{#1}} \define@key{bbrbox}{minheight}[]{\renewcommand*\bbrboxminheight{#1}} \define@key{bbrbox}{xshift}[]{\renewcommand*\bbrboxxshift{#1}} \define@key{bbrbox}{yshift}[]{\renewcommand*\bbrboxyshift{#1}} \NewEnviron{bbrbox}[1][]{% \setkeys{bbrbox}{#1}% \ifthenelse{\equal{\bbrboxnamepos}{center}} {\renewcommand{\@bbrboxnamepos}{below=0.5ex of \@bb@lastbox.north,anchor=north}}{} \ifthenelse{\equal{\bbrboxnamepos}{left}} {\renewcommand{\@bbrboxnamepos}{below=0.5ex of \@bb@lastbox.north west,anchor=north west}}{} \ifthenelse{\equal{\bbrboxnamepos}{top right}} {\renewcommand{\@bbrboxnamepos}{above=0cm of \@bb@lastbox.north east,anchor=south east}\renewcommand{\@bbrboxnameposoffset}{below left=0cm of phantomname.north west}}{} \ifthenelse{\equal{\bbrboxnamepos}{top center}} {\renewcommand{\@bbrboxnamepos}{above=0cm of \@bb@lastbox.north,anchor=south}\renewcommand{\@bbrboxnameposoffset}{below left=0cm of phantomname.north west}}{} \ifthenelse{\equal{\bbrboxnamepos}{top left}} {\renewcommand{\@bbrboxnamepos}{above=0cm of \@bb@lastbox.north west,anchor=south west}\renewcommand{\@bbrboxnameposoffset}{below left=0cm of phantomname.north west}}{} \ifthenelse{\equal{\bbrboxnamepos}{middle}} {\renewcommand{\@bbrboxnamepos}{above=0.5ex of \@bb@lastbox.base,anchor=south}}{} \ifthenelse{\equal{\bbrboxnamepos}{bottom}} {\renewcommand{\@bbrboxnamepos}{above=0.5ex of \@bb@lastbox.base,anchor=north}}{} \tikzset{BBRBOXSTYLE/.style/.expand once=\bbrboxstyle}% \tikzset{BBRBOXNAMEPOS/.style/.expand once=\@bbrboxnamepos}% \tikzset{BBRBOXNAMESTYLE/.style/.expand once=\bbrboxnamestyle}% \tikzset{BBRBOXNAMEPOSOFFSET/.style/.expand once=\@bbrboxnameposoffset}% \coordinate[inner sep=0pt,outer sep=0pt] (\@bb@lastbox-tmpouter) {}; \node at (\@bb@lastbox-tmpouter) {}; %this empty node seems needed to get the xyshift right. \node[inner sep=.3333em,anchor=north,BBRBOXSTYLE,minimum height=\bbrboxminheight,below right=\bbrboxyshift and \bbrboxxshift of \@bb@lastbox-tmpouter] (\@bb@lastbox) \bgroup \tikz{ \node[inner sep=0pt,outer sep=0pt,minimum height=0cm] (phantomname) {}; %minimum width \node[BBRBOXNAMEPOSOFFSET,minimum height=0cm] (\@bb@lastbox-inner) {\begin{varwidth}{2\linewidth}\BODY\end{varwidth}}; \ifthenelse{\equal{\bbrboxafterskip}{}}{}{ \node[below=0cm of \@bb@lastbox-inner,minimum height=\bbrboxafterskip] {}; } \node[inner sep=0pt,outer sep=0pt,at=(\@bb@lastbox-inner.south west),minimum height=0cm] () {\phantom{\hspace{\bbrboxminwidth}}}; %minimum width } \egroup; \ifthenelse{\equal{\bbrboxnamepos}{none}} {}{\node[BBRBOXNAMEPOS,BBRBOXNAMESTYLE, inner sep=0.2ex, outer sep=0pt, overlay] () {\bbrboxname};} } \newcommand*\bbroraclevdistance{\baselineskip} \newcommand*\bbroraclehdistance{1.5cm} \define@key{bbroracle}{distance}[]{\renewcommand*\bbroraclehdistance{#1}} \define@key{bbroracle}{hdistance}[]{\renewcommand*\bbroraclehdistance{#1}} \define@key{bbroracle}{vdistance}[]{\renewcommand*\bbroraclevdistance{#1}} \newenvironmentx{bbroracle}[2][2=]{% \begingroup \setkeys{bbroracle}{#2} \gdef\@bbr@first@oraclequery{true} \addtocounter{@bb@oracle@nestcnt}{1} \addtocounter{@bb@oracle@cnt}{1} \ifthenelse{\value{@bb@oracle@cnt}=1}{ \setlength{\@bb@tmplength@b}{\bbroraclevdistance-\baselineskip} \node[inner sep=0pt,below right=\@bb@tmplength@b and \bbroraclehdistance of \@bb@lastbox.north east,anchor=north west] (\bbroraclenodenameprefix#1) \bgroup }{ \coordinate (@bbtmpcoord) at (\@bb@lastbox.north east); \path (@bbtmpcoord); \pgfgetlastxy{\XCoord}{\YCoordA} \coordinate (@bbtmpcoord) at (\bbroraclenodenameprefix \@bb@lastoracle.south west); \path (@bbtmpcoord); \pgfgetlastxy{\XCoord}{\YCoordB} \setlength{\@bb@tmplength@b}{\YCoordA-\YCoordB+\bbroraclevdistance} \node[inner sep=0pt,below right=\@bb@tmplength@b and \bbroraclehdistance of \@bb@lastbox.north east,anchor=north west] (\bbroraclenodenameprefix#1) \bgroup } \global\def\@bb@lastoracle{#1} \begin{bbrenv}{#1} }{ \end{bbrenv} \egroup; \addtocounter{@bb@oracle@nestcnt}{-1} \endgroup } \newcommand*\bbrchallengerhdistance{1.5cm} \newcommand*\bbrchallengervdistance{\baselineskip} \define@key{bbrchallenger}{distance}[]{\renewcommand*\bbrchallengerhdistance{#1}} \define@key{bbrchallenger}{hdistance}[]{\renewcommand*\bbrchallengerhdistance{#1}} \define@key{bbrchallenger}{vdistance}[]{\renewcommand*\bbrchallengervdistance{#1}} \newenvironmentx{bbrchallenger}[2][2=]{% \begingroup% \setkeys{bbrchallenger}{#2}% \gdef\@bbr@first@challengerquery{true}% \addtocounter{@bb@challenger@nestcnt}{1}% \addtocounter{@bb@challenger@cnt}{1}% \ifthenelse{\value{@bb@challenger@cnt}=1}{% \setlength{\@bb@tmplength@b}{\bbrchallengervdistance-\baselineskip}% \node[inner sep=0pt,outer sep=0pt,below left=\@bb@tmplength@b and \bbrchallengerhdistance of \@bb@lastbox.north west,anchor=north east] (\bbrchallengernodenameprefix#1) \bgroup% }{% \coordinate (@bbtmpcoord) at (\@bb@lastbox.north west);% \path (@bbtmpcoord);% \pgfgetlastxy{\XCoord}{\YCoordA}% \coordinate (@bbtmpcoord) at (\bbrchallengernodenameprefix \@bb@lastchallenger.south east);% \path (@bbtmpcoord);% \pgfgetlastxy{\XCoord}{\YCoordB}% \setlength{\@bb@tmplength@b}{\YCoordA-\YCoordB+\bbrchallengervdistance}% \node[inner sep=0pt,below left=\@bb@tmplength@b and \bbrchallengerhdistance of \@bb@lastbox.north west,anchor=north east] (\bbrchallengernodenameprefix#1) \bgroup% }% \global\def\@bb@lastchallenger{#1} \begin{bbrenv}{#1}% }{ \end{bbrenv}% \egroup;% \addtocounter{@bb@challenger@nestcnt}{-1}% \endgroup% \let\msgfrom\bbrchallengerqueryto% } \newcommand*\bbrinputlength{0.5cm} \newcommand*\bbrinputhoffset{0.5cm} \newcommand*\bbrinputbottom{} \newcommand*\bbrinputtop{} \newcommand*\bbrinputedgestyle{} \newcommand*\bbrinputtopstyle{} \newcommand*\bbrinputbottomstyle{} \newcommand*\bbrinputnodestyle{} \newcommand*\bbrinputnodename{} \define@key{bbrinput}{length}[]{\renewcommand*\bbrinputlength{#1}} \define@key{bbrinput}{hoffset}[]{\renewcommand*\bbrinputhoffset{#1}} \define@key{bbrinput}{name}[]{\renewcommand*\bbrinputnodename{#1}} \define@key{bbrinput}{top}[]{\renewcommand*\bbrinputtop{#1}} \define@key{bbrinput}{bottom}[]{\renewcommand*\bbrinputbottom{#1}} \newcommand{\@bb@inputsetup}[1]{ \begingroup % for local keys \setkeys{bbrinput}{#1}% \tikzset{BBRINPUT-NODESTYLE/.style/.expand once=\bbrinputedgestyle}% \tikzset{BBRINPUT-TOPSTYLE/.style/.expand once=\bbrinputtopstyle}% \tikzset{BBRINPUT-BOTTOMSTYLE/.style/.expand once=\bbrinputbottomstyle}% \tikzset{BBRINPUT-EDGESTYLE/.style/.expand once=\bbrinputedgestyle}% } \newcommand{\@bb@inputfinalize}{ \endgroup } \newcommandx*{\bbrinput}[2][2=]{% \@bb@inputsetup{#2} \ifthenelse{\equal{\bbrinputnodename}{}} {\renewcommand{\bbrinputnodename}{\@bb@lastbox-input}}{} \node[overlay,above right={\bbrinputlength} and {\bbrinputhoffset} of \@bb@lastbox.north west, anchor=south,BBRINPUT-NODESTYLE] (\bbrinputnodename) {#1}; \path[->] (\bbrinputnodename.south) edge[BBRINPUT-EDGESTYLE] node[above,anchor=east,BBRINPUT-TOPSTYLE] () {\bbrinputtop} node[below,anchor=west,BBRINPUT-BOTTOMSTYLE] () {\bbrinputbottom} (\bbrinputnodename.south|-\@bb@lastbox.north); \@bb@inputfinalize } \newcommandx*{\bbroutput}[2][2=]{% \@bb@inputsetup{#2} \ifthenelse{\equal{\bbrinputnodename}{}} {\renewcommand{\bbrinputnodename}{\@bb@lastbox-output}}{} \node[overlay,below right={\bbrinputlength} and {\bbrinputhoffset} of \@bb@lastbox.south west, anchor=north] (\bbrinputnodename) {#1}; \draw[->] (\bbrinputnodename.north|-\@bb@lastbox.south) -- (\bbrinputnodename.north|-\bbrinputnodename.north); \@bb@inputfinalize } \newenvironment{bbrpic}[1][]{% \begin{tikzpicture}[overlay,inner sep=0ex,baseline=0pt,#1]% }{% \end{tikzpicture}} \newlength{\@bb@com@tmpoffset} \newlength{\@bb@tmplength@b} \newcommand*\@bbrcomsidestyle{} \newcommand*\@bbrcomosidestyle{} \newcommand*\@bbrcomtopstyle{} \newcommand*\@bbrcombottomstyle{} \newcommand*\@bbrcomside{} \newcommand*\@bbrcomoside{} \newcommand*\@bbrcomtop{} \newcommand*\@bbrcombottom{} \newcommand*\@bbrcomedgestyle{} \newcommand*\@bbrcomlength{1.25cm} \newcommand*\@bbrcomtopname{bbrcomtop} \newcommand*\@bbrcombottomname{bbrcombottom} \newcommand*\@bbrcomsidename{bbrcomside} \newcommand*\@bbrcomosidename{bbrcomoside} \newcommand*\@bbrcombeforeskip{0pt} \newcommand*\@bbrcomafterskip{0ex} \define@key{bbrcom}{sidestyle}[]{\renewcommand*\@bbrcomsidestyle{#1}} \define@key{bbrcom}{osidestyle}[]{\renewcommand*\@bbrcomosidestyle{#1}} \define@key{bbrcom}{topstyle}[]{\renewcommand*\@bbrcomtopstyle{#1}} \define@key{bbrcom}{bottomstyle}[]{\renewcommand*\@bbrcombottomstyle{#1}} \define@key{bbrcom}{side}[]{\renewcommand*\@bbrcomside{#1}} \define@key{bbrcom}{oside}[]{\renewcommand*\@bbrcomoside{#1}} \define@key{bbrcom}{top}[]{\renewcommand*\@bbrcomtop{#1}} \define@key{bbrcom}{bottom}[]{\renewcommand*\@bbrcombottom{#1}} \define@key{bbrcom}{edgestyle}[]{\renewcommand*\@bbrcomedgestyle{#1}} \define@key{bbrcom}{length}[]{\renewcommand*\@bbrcomlength{#1}} \define@key{bbrcom}{topname}[]{\renewcommand*\@bbrcomtopname{#1}} \define@key{bbrcom}{bottomname}[]{\renewcommand*\@bbrcombottomname{#1}} \define@key{bbrcom}{sidename}[]{\renewcommand*\@bbrcomsidename{#1}} \define@key{bbrcom}{osidename}[]{\renewcommand*\@bbrcomosidename{#1}} \define@key{bbrcom}{beforeskip}[]{\renewcommand*\@bbrcombeforeskip{#1}} \define@key{bbrcom}{aboveskip}[]{\renewcommand*\@bbrcombeforeskip{#1}} \define@key{bbrcom}{afterskip}[]{\renewcommand*\@bbrcomafterskip{#1}} \define@key{bbrcom}{belowskip}[]{\renewcommand*\@bbrcomafterskip{#1}} \newcommand*\@bbrcomfixedoffset{} \newcommand*\@bbrcomfixedboffset{false} \define@key{bbrcom}{fixedoffset}[]{\renewcommand*\@bbrcomfixedoffset{#1}} \define@key{bbrcom}{fixedboffset}[]{\renewcommand*\@bbrcomfixedoffset{#1}\renewcommand*\@bbrcomfixedboffset{true}} \newcommand*\@bbrbasenodestyle{} \newcommand*\@bbrbasenodename{bbrtmpname} \define@key{bbrabase}{nodestyle}[]{\renewcommand*\@bbrbasenodestyle{#1}} \define@key{bbrabase}{nodename}[]{\renewcommand*\@bbrbasenodename{#1}} \newcommand*\@bbr@first@msg{true} \newcommand*\@bbr@first@query{true} \newcommand*\@bbr@first@oraclequery{true} \newcommand*\@bbr@first@challengerquery{true} \newcommand*\@bbr@intermessage@skip{4ex} \newcommand*\@bbr@intermessage@veryshortskip{1ex} \newcommand*\@bbr@intermessage@shortskip{1.5ex} \newcommand*\@bbr@intermessage@medskip{2.5ex} \newcommand*\@bbrcomislast{false} \define@key{bbrcom}{islast}[true]{\renewcommand*\@bbrcomislast{#1}} \newcommand*\@bbrcom@check@islast{% \ifthenelse{\equal{\@bbrcomislast}{true}} {\renewcommand*\@bbrcomfixedoffset{\bbrfirstmessageoffset}\renewcommand*\@bbrcomfixedboffset{true}} {} } \def\@bbr@lastskip{0pt} \newcommand{\@bb@comsetup}[4]{ \edef\@tmp@bbr@isfirst{#4} \renewcommand#4{false} \begingroup % for local keys \setkeys{bbrcom}{#1}% \tikzset{BBRCOM-SIDESTYLE/.style/.expand once=\@bbrcomsidestyle}% \tikzset{BBRCOM-OSIDESTYLE/.style/.expand once=\@bbrcomosidestyle}% \tikzset{BBRCOM-TOPSTYLE/.style/.expand once=\@bbrcomtopstyle}% \tikzset{BBRCOM-BOTTOMSTYLE/.style/.expand once=\@bbrcombottomstyle}% \tikzset{BBRCOM-EDGESTYLE/.style/.expand once=\@bbrcomedgestyle}% \@bbrcom@check@islast{} #3{\@bbrcombeforeskip} \ifthenelse{\equal{\@bbrcomfixedoffset}{}} { \ifthenelse{\equal{\@tmp@bbr@isfirst}{true}} {}{#3{\@bbr@lastskip}} \setlength{\@bb@com@tmpoffset}{#2}% } { \setlength{\@bb@com@tmpoffset}{\@bbrcomfixedoffset}% } } \newcommand{\@bb@comfinalize}[1]{ #1{\@bbrcomafterskip} \endgroup \def\@bbr@lastskip{\@bbr@intermessage@skip} } \newcommand{\@bbrmsg}[9]{ \@bb@comsetup{#1}{#7}{#8}{#9} \ifthenelse{\equal{\@bbrcomfixedboffset}{true}} { \ifthenelse{\equal{#4}{north east}}{\def\@bbr@tmp@bottomanchor{south east}}{} \ifthenelse{\equal{#4}{north west}}{\def\@bbr@tmp@bottomanchor{south west}}{} \node[#3=-\@bb@com@tmpoffset and \@bbrcomlength of \@bb@lastbox.\@bbr@tmp@bottomanchor,anchor=#6,BBRCOM-SIDESTYLE] (\@bbrcomsidename) {\@bbrcomside}; } { \node[#3=\@bb@com@tmpoffset and \@bbrcomlength of \@bb@lastbox.#4,anchor=#6,BBRCOM-SIDESTYLE] (\@bbrcomsidename) {\@bbrcomside}; } \path[#2] (\@bbrcomsidename.#6) edge[BBRCOM-EDGESTYLE] node[above,BBRCOM-TOPSTYLE] (\@bbrcomtopname) {\@bbrcomtop} node[below,BBRCOM-BOTTOMSTYLE] (\@bbrcombottomname) {\@bbrcombottom} (\@bb@lastbox.#5|-\@bbrcomsidename) -- (\@bb@lastbox.#5|-\@bbrcomsidename) node[inner sep=0pt,outer sep=0pt,BBRCOM-OSIDESTYLE] (\@bbrcomosidename) {}; \@bb@comfinalize{#8} } \newcommandx{\bbrmsgto}[1]{% \@bbrmsg{#1}{->}{below left}{north west}{west}{east}{\@bb@message@voffset}{\bbrmsgspace}{\@bbr@first@msg} } \newcommandx{\bbrmsgfrom}[1]{% \@bbrmsg{#1}{<-}{below left}{north west}{west}{east}{\@bb@message@voffset}{\bbrmsgspace}{\@bbr@first@msg} } \newcommandx{\bbrmsgtofrom}[2]{% \bbrmsgto{#1} \bbrmsgspace{-\@bbr@intermessage@skip} \bbrmsgspace{\@bbr@intermessage@shortskip} \bbrmsgfrom{#2} \bbrmsgspace{\@bbr@intermessage@medskip} } \newcommandx{\bbrmsgfromto}[2]{% \bbrmsgfrom{#1} \bbrmsgspace{-\@bbr@intermessage@skip} \bbrmsgspace{\@bbr@intermessage@shortskip} \bbrmsgto{#2} \bbrmsgspace{\@bbr@intermessage@medskip} } \newcommandx{\bbrmsgvdots}{% \bbrmsgtxt[xshift=\@bbrcomlength/2,afterskip=\@bbr@intermessage@skip]{$\vdots$} } \newcommandx{\bbrqryto}[1]{% \@bbrmsg{#1}{<-}{below right}{north east}{east}{west}{\@bb@query@voffset}{\bbrqryspace}{\@bbr@first@query} } \newcommandx{\bbrqryfrom}[1]{% \@bbrmsg{#1}{->}{below right}{north east}{east}{west}{\@bb@query@voffset}{\bbrqryspace}{\@bbr@first@query} } \newcommand*{\bbrqrytofrom}[2]{% \bbrqryto{#1} \bbrqryspace{-\@bbr@intermessage@skip} \bbrqryspace{\@bbr@intermessage@shortskip} \bbrqryfrom{#2} \bbrqryspace{\@bbr@intermessage@medskip} } \newcommand*{\bbrqryfromto}[2]{% \bbrqryfrom{#1} \bbrqryspace{-\@bbr@intermessage@skip} \bbrqryspace{\@bbr@intermessage@shortskip} \bbrqryto{#2} \bbrqryspace{\@bbr@intermessage@medskip} } \newcommand{\@bbroracleqry}[4]{ \@bb@comsetup{#1}{#3}{#4}{\@bbr@first@oraclequery} \ifthenelse{\equal{\@bbrcomfixedboffset}{true}} { \path[#2] (\@bb@lastoracle.south west) -- ++ (0,\@bb@com@tmpoffset) node[inner sep=0pt,outer sep=0pt,anchor=west,BBRCOM-SIDESTYLE] (\@bbrcomsidename){\@bbrcomside} edge[BBRCOM-EDGESTYLE] node[above,BBRCOM-TOPSTYLE] (\@bbrcomtopname) {\@bbrcomtop} node[below,BBRCOM-BOTTOMSTYLE] (\@bbrcombottomname) {\@bbrcombottom} (\@bb@lastbox.east|-\@bbrcomsidename) -- (\@bb@lastbox.east|-\@bbrcomsidename) node[inner sep=0pt,outer sep=0pt,anchor=east,BBRCOM-OSIDESTYLE] (\@bbrcomosidename) {\@bbrcomoside}; } { \path[#2] (\@bb@lastoracle.north west) -- ++ (0,-\@bb@com@tmpoffset) node[inner sep=0pt,outer sep=0pt,anchor=west,BBRCOM-SIDESTYLE] (\@bbrcomsidename){\@bbrcomside} edge[BBRCOM-EDGESTYLE] node[above,BBRCOM-TOPSTYLE] (\@bbrcomtopname) {\@bbrcomtop} node[below,BBRCOM-BOTTOMSTYLE] (\@bbrcombottomname) {\@bbrcombottom} (\@bb@lastbox.east|-\@bbrcomsidename) -- (\@bb@lastbox.east|-\@bbrcomsidename) node[inner sep=0pt,outer sep=0pt,anchor=east,BBRCOM-OSIDESTYLE] (\@bbrcomosidename) {\@bbrcomoside}; } \@bb@comfinalize{#4} } \newcommand{\bbroracleqryfrom}[1]{ \@bbroracleqry{#1}{->}{\@bb@oraclequery@voffset}{\bbroracleqryspace} } \newcommand{\bbroracleqryto}[1]{ \@bbroracleqry{#1}{<-}{\@bb@oraclequery@voffset}{\bbroracleqryspace} } \newcommand*{\bbroracleqrytofrom}[2]{% \bbroracleqryto{#1} \bbroracleqryspace{-\@bbr@intermessage@skip} \bbroracleqryspace{\@bbr@intermessage@shortskip} \bbroracleqryfrom{#2} \bbroracleqryspace{\@bbr@intermessage@medskip} } \newcommand*{\bbroracleqryfromto}[2]{% \bbroracleqryfrom{#1} \bbroracleqryspace{-\@bbr@intermessage@skip} \bbroracleqryspace{\@bbr@intermessage@shortskip} \bbroracleqryto{#2} \bbroracleqryspace{\@bbr@intermessage@medskip} } \newcommand{\@bbrchallengerqry}[4]{ \@bb@comsetup{#1}{#3}{#4}{\@bbr@first@challengerquery} \ifthenelse{\equal{\@bbrcomfixedboffset}{true}} { \path[#2] (\@bb@lastchallenger.south east) -- ++ (0,\@bb@com@tmpoffset) node[inner sep=0pt,outer sep=0pt,anchor=east,BBRCOM-SIDESTYLE] (\@bbrcomsidename){\@bbrcomside} edge[BBRCOM-EDGESTYLE] node[above,BBRCOM-TOPSTYLE] (\@bbrcomtopname) {\@bbrcomtop} node[below,BBRCOM-BOTTOMSTYLE] (\@bbrcombottomname) {\@bbrcombottom} (\@bb@lastbox.west|-\@bbrcomsidename) -- (\@bb@lastbox.west|-\@bbrcomsidename) node[inner sep=0pt,outer sep=0pt,anchor=west,BBRCOM-OSIDESTYLE] (\@bbrcomosidename) {\@bbrcomoside}; } { \path[#2] (\@bb@lastchallenger.north east) -- ++ (0,-\@bb@com@tmpoffset) node[inner sep=0pt,outer sep=0pt,anchor=east,BBRCOM-SIDESTYLE] (\@bbrcomsidename){\@bbrcomside} edge[BBRCOM-EDGESTYLE] node[above,BBRCOM-TOPSTYLE] (\@bbrcomtopname) {\@bbrcomtop} node[below,BBRCOM-BOTTOMSTYLE] (\@bbrcombottomname) {\@bbrcombottom} (\@bb@lastbox.west|-\@bbrcomsidename) -- (\@bb@lastbox.west|-\@bbrcomsidename) node[inner sep=0pt,outer sep=0pt,anchor=west,BBRCOM-OSIDESTYLE] (\@bbrcomosidename) {\@bbrcomoside}; } \@bb@comfinalize{#4} } \newcommand{\bbrchallengerqryfrom}[1]{ \@bbrchallengerqry{#1}{<-}{\@bb@challengerquery@voffset}{\bbrchallengerqryspace} } \newcommand{\bbrchallengerqryto}[1]{ \@bbrchallengerqry{#1}{->}{\@bb@challengerquery@voffset}{\bbrchallengerqryspace} } \newcommand*{\bbrchallengerqrytofrom}[2]{% \bbrchallengerqryto{#1} \bbrchallengerqryspace{-\@bbr@intermessage@skip} \bbrchallengerqryspace{\@bbr@intermessage@shortskip} \bbrchallengerqryfrom{#2} \bbrchallengerqryspace{\@bbr@intermessage@medskip} } \newcommand*{\bbrchallengerqryfromto}[2]{% \bbrchallengerqryfrom{#1} \bbrchallengerqryspace{-\@bbr@intermessage@skip} \bbrchallengerqryspace{\@bbr@intermessage@shortskip} \bbrchallengerqryto{#2} \bbrchallengerqryspace{\@bbr@intermessage@medskip} } \newcommand*\bbrcomloopleft{} \newcommand*\bbrcomloopleftstyle{} \newcommand*\bbrcomloopright{} \newcommand*\bbrcomlooprightstyle{} \newcommand*\bbrcomloopcenter{} \newcommand*\bbrcomloopcenterstyle{} \newcommand*\bbrcomloopclockwise{false} \newcommand*\bbrcomloopangle{50} \define@key{bbrcomloop}{left}[]{\renewcommand*\bbrcomloopleft{#1}} \define@key{bbrcomloop}{leftstyle}[]{\renewcommand*\bbrcomloopleftstyle{#1}} \define@key{bbrcomloop}{right}[]{\renewcommand*\bbrcomloopright{#1}} \define@key{bbrcomloop}{rightstyle}[]{\renewcommand*\bbrcomlooprightstyle{#1}} \define@key{bbrcomloop}{center}[]{\renewcommand*\bbrcomloopcenter{#1}} \define@key{bbrcomloop}{centerstyle}[]{\renewcommand*\bbrcomloopcenterstyle{#1}} \define@key{bbrcomloop}{angle}[]{\renewcommand*\bbrcomloopangle{#1}} \define@key{bbrcomloop}{clockwise}[true]{\renewcommand*\bbrcomloopclockwise{#1}} \newcommand{\bbrloop}[3]{ \begingroup % for local keys \setkeys{bbrcomloop}{#3}% \tikzset{BBRLOOP-LEFTSTYLE/.style/.expand once=\bbrcomloopleftstyle}% \tikzset{BBRLOOP-RIGHTSTYLE/.style/.expand once=\bbrcomlooprightstyle}% \tikzset{BBRLOOP-CENTERSTYLE/.style/.expand once=\bbrcomloopcenterstyle}% \ifthenelse{\equal{\bbrcomloopclockwise}{true}} { \path[->] (#1) edge[bend left=\bbrcomloopangle] node[midway,left,inner sep=0,outer sep=0,BBRLOOP-LEFTSTYLE] (bbrleft) {\bbrcomloopleft} (#2); \path[->] (#2) edge[bend left=\bbrcomloopangle] node[midway,right,inner sep=0,outer sep=0,BBRLOOP-RIGHTSTYLE] (bbrright) {\bbrcomloopright} (#1); } { \path[->] (#1) edge[bend right=\bbrcomloopangle] node[midway,left,inner sep=0,outer sep=0,] (bbrleft) {\bbrcomloopleft} (#2); \path[->] (#2) edge[bend right=\bbrcomloopangle] node[midway,right,inner sep=0,outer sep=0,] (bbrright) {\bbrcomloopright} (#1); } \node[at=($(bbrleft.west)!0.5!(bbrright.east)$),anchor=center,BBRLOOP-CENTERSTYLE]() {\bbrcomloopcenter}; \endgroup } \newcommand*\bbrintertexthoffset{1.5cm} \define@key{bbrintertext}{xshift}[]{\renewcommand*\bbrintertexthoffset{#1}} \newcommand{\@bb@intertextsetup}[1]{ \begingroup % for local keys %\if@minipage\kern-0.5\abovedisplayskip\fi \setkeys{bbrcom,bbrabase,bbrintertext}{#1}% \@bbrcom@check@islast{} \tikzset{BBRBASE-NODESTYLE/.style/.expand once=\@bbrbasenodestyle}% } \newcommand{\@bb@intertextfinalize}[1]{ #1{\@bbrcomafterskip} \endgroup \def\@bbr@lastskip{\@bbr@intermessage@veryshortskip} } \newcommand{\@bbrintertext}[7]{ \edef\@tmp@bbr@isfirst{#7} \renewcommand#7{false} \@bb@intertextsetup{#1} #5{\@bbrcombeforeskip} \ifthenelse{\equal{\@bbrcomfixedoffset}{}} { \ifthenelse{\equal{\@tmp@bbr@isfirst}{true}} {}{#5{\@bbr@intermessage@veryshortskip}} \setlength{\@bb@com@tmpoffset}{#4}% } { \setlength{\@bb@com@tmpoffset}{\@bbrcomfixedoffset}% } \ifthenelse{\equal{\@bbrcomfixedboffset}{true}} { \ifthenelse{\equal{#3}{north east}}{\def\@bbr@tmp@bottomanchor{south east}}{} \ifthenelse{\equal{#3}{north west}}{\def\@bbr@tmp@bottomanchor{south west}}{} \node[#2=-\@bb@com@tmpoffset and \bbrintertexthoffset of \@bb@lastbox.\@bbr@tmp@bottomanchor, inner sep=0, outer sep=0, BBRBASE-NODESTYLE] (\@bbrbasenodename) {#6}; } { \node[#2=\@bb@com@tmpoffset and \bbrintertexthoffset of \@bb@lastbox.#3, inner sep=0, outer sep=0, BBRBASE-NODESTYLE] (\@bbrbasenodename) {#6}; } \coordinate (@bbtmpcoord) at (\@bbrbasenodename.north); \path (@bbtmpcoord); \pgfgetlastxy{\XCoord}{\YCoordA} \coordinate (@bbtmpcoord) at (\@bbrbasenodename.south); \path (@bbtmpcoord); \pgfgetlastxy{\XCoord}{\YCoordB} \setlength{\@bb@tmplength@b}{\YCoordA-\YCoordB} #5{\the\@bb@tmplength@b} \@bb@intertextfinalize{#5} } \newcommand{\bbrmsgtxt}[2][]{ \@bbrintertext{#1}{below left}{north west}{\@bb@message@voffset}{\bbrmsgspace}{#2}{\@bbr@first@msg} } \newcommand{\bbrqrytxt}[2][]{ \@bbrintertext{#1}{below right}{north east}{\@bb@query@voffset}{\bbrqryspace}{#2}{\@bbr@first@query} } \newcommand{\bbrchallengertxt}[2][]{ \begingroup \setlength{\@bb@tmplength@b}{\bbrchallengerhdistance/2}% \renewcommand{\bbrintertexthoffset}{\the\@bb@tmplength@b}% \@bbrintertext{#1}{below left}{north west}{\@bb@challengerquery@voffset}{\bbrchallengerqryspace}{#2}{\@bbr@first@challengerquery} \endgroup } \newcommand{\bbroracletxt}[2][]{ \begingroup \setlength{\@bb@tmplength@b}{\bbroraclehdistance/2}% \renewcommand{\bbrintertexthoffset}{\the\@bb@tmplength@b}% \@bbrintertext{#1}{below left}{north west}{\@bb@oraclequery@voffset}{\bbroracleqryspace}{#2}{\@bbr@first@oraclequery} \endgroup } \newcommand{\bbrmsgspace}[1]{ \@pc@globaladdtolength{\@bb@message@voffset}{#1} } \newcommand{\bbrqryspace}[1]{ \@pc@globaladdtolength{\@bb@query@voffset}{#1} } \newcommand{\bbroracleqryspace}[1]{ \@pc@globaladdtolength{\@bb@oraclequery@voffset}{#1} } \newcommand{\bbrchallengerqryspace}[1]{ \@pc@globaladdtolength{\@bb@challengerquery@voffset}{#1} } \newcounter{pcstartgamecounter} \definecolor{gamechangecolor}{gray}{0.90} \newcommand{\gamechange}[2][gamechangecolor]{% {\setlength{\fboxsep}{0pt}\colorbox{#1}{\ifmmode$\displaystyle#2$\else#2\fi}}% } \newcommand{\pcbox}[1]{% {\setlength{\fboxsep}{3pt}\fbox{$\displaystyle#1$}} } \newcommand*{\pcgamename}{Game} \newcommand*{\pcgameprocedurestyle}[1]{\ensuremath{\mathsf{#1}}} \def\pcgame{\bgroup\pcgame@} \newcommand{\pcgame@}[1][]{\ifthenelse{\equal{#1}{}}{\pcgame@@}{\pcgame@@@{#1}}} \def\pcgame@@{\pcgameprocedurestyle{\pcgamename}\egroup} \def\pcgame@@@#1{\ensuremath{\pcgameprocedurestyle{\pcgamename_{\normalfont{#1}}}}\egroup} \newcommand\@pc@gametitle[1][]{\ifthenelse{\equal{#1}{}} {\ensuremath{\pcgame[\thepcgamecounter]\gameprocedurearg}} {\ensuremath{\pcgame[#1]\gameprocedurearg}}} \newcommand*{\gameprocedurearg}{\ensuremath{(\secpar)}} \newcommand*\@pcgameproofgamenr{0} \define@key{pcgameproof}{nr}[]{\renewcommand*\@pcgameproofgamenr{#1}} \define@key{pcgameproof}{name}[]{\renewcommand*\pcgamename{\ensuremath{#1}}} \define@key{pcgameproof}{arg}[]{\renewcommand*\gameprocedurearg{\ensuremath{#1}}} \newenvironment{gameproof}[1][]{% \begingroup% \setkeys{pcgameproof}{#1}% \@pc@ensureremember% \setcounter{pcgamecounter}{\@pcgameproofgamenr}% \setcounter{pcstartgamecounter}{\@pcgameproofgamenr}\stepcounter{pcstartgamecounter}% }{\@pc@releaseremember\endgroup} \newcommand{\setgameproceduredefaultstyle}[1]{% \PackageWarning{cryptocode}{Deprecated command setgameproceduredefaultstyle. Use pcsetargs instead.}% \pcsetargs{#1}} \createpseudocodecommand{gameprocedure} {\addtocounter{pcgamecounter}{1}\renewcommand{\@withingame}{true}} {\@pc@gametitle} {} \def\@bxgame@pseudocodeA[#1]#2#3{\setkeys*{pcspace}{#1}\renewcommand{\@bxgameheader}{\@pc@gametitle[#2]}% \@pseudocode[head=\@pc@gametitle,#1]{#3}} \def\@bxgame@pseudocodeB#1#2{\renewcommand{\@bxgameheader}{\@pc@gametitle[#1]}% \@pseudocode[head=\@pc@gametitle]{#2}} \newcommand{\bxgameprocedure}{ \begingroup% \renewcommand{\@withinspaces}{false}% \renewcommand{\@withingame}{true}% \renewcommand{\@withinbxgame}{true}% \stepcounter{pcgamecounter}% \@ifnextchar[%] {\@bxgame@pseudocodeA} {\@bxgame@pseudocodeB}% } \newcommand{\@pc@secondheader}{} \createpseudocodecommand{tbxgameprocedure} {\addtocounter{pcgamecounter}{1}\renewcommand{\@withingame}{true}% \renewcommand{\@pc@secondheader}{true}} {\@pc@gametitle} {} \newcommand*\@pcgamehopnodestyle{} \newcommand*\@pcgamehopedgestyle{bend left} \newcommand*\@pcgamehoppathestyle{} \newcommand*\@pcgamehophint{} \newcommand*\@pcgamehophintbelow{} \newcommand*\@pcgamehopinhint{} \newcommand*\@pcgamehoplength{1.5cm} \define@key{pcgamehop}{nodestyle}[]{\renewcommand*\@pcgamehopnodestyle{#1}} \define@key{pcgamehop}{edgestyle}[]{\renewcommand*\@pcgamehopedgestyle{#1}} \define@key{pcgamehop}{pathstyle}[]{\renewcommand*\@pcgamehoppathestyle{#1}} \define@key{pcgamehop}{hint}[]{\renewcommand*\@pcgamehophint{#1}} \define@key{pcgamehop}{belowhint}[]{\renewcommand*\@pcgamehophintbelow{#1}} \define@key{pcgamehop}{inhint}[]{\renewcommand*\@pcgamehopinhint{#1}} \define@key{pcgamehop}{length}[]{\renewcommand*\@pcgamehoplength{#1}} \newcommand{\@pc@setupgamehop}[1]{ \begingroup\setkeys{pcgamehop}{#1}% \tikzset{GAMEHOP-PATH-STYLE/.style/.expand once=\@pcgamehoppathestyle}% \tikzset{GAMEHOP-NODE-STYLE/.style/.expand once=\@pcgamehopnodestyle}% \tikzset{GAMEHOP-EDGE-STYLE/.style/.expand once=\@pcgamehopedgestyle}% } \newcommand{\@pc@finalizegamehop}{ \endgroup } \newcommandx*{\addgamehop}[3]{% \begingroup% \ifthenelse{#1<#2}% {\ifthenelse{\equal{\@withingamedescription}{true}}% {\renewcommand*\@pcgamehopedgestyle{bend right=20}\renewcommand*\@pcgamehopnodestyle{rotate=90}}{}% }% {\renewcommand*\@pcgamehopedgestyle{bend right}}% \@pc@setupgamehop{#3}% \begin{tikzpicture}[overlay]% \ifthenelse{#1<#2}{% \path[->,GAMEHOP-PATH-STYLE] (gamenode#1) edge[GAMEHOP-EDGE-STYLE] node[above,GAMEHOP-NODE-STYLE] {\@pcgamehophint} node[below,GAMEHOP-NODE-STYLE] {\@pcgamehophintbelow} (gamenode#2); }{% \path[->,GAMEHOP-PATH-STYLE] (bgamenode#1) edge[GAMEHOP-EDGE-STYLE] node[above,GAMEHOP-NODE-STYLE] {\@pcgamehophint} node[above,GAMEHOP-NODE-STYLE] {\@pcgamehophintbelow} (bgamenode#2); }% \end{tikzpicture}% \@pc@finalizegamehop% \endgroup% } \newcommandx*{\addstartgamehop}[2][1=\thepcstartgamecounter]{% \@pc@setupgamehop{#2} \begin{tikzpicture}[overlay] \node[left=\@pcgamehoplength of gamenode#1] (tmpgamenode0) {}; \path[->,GAMEHOP-PATH-STYLE] (tmpgamenode0) edge[GAMEHOP-EDGE-STYLE] node[above,GAMEHOP-NODE-STYLE] {\@pcgamehophint} node[below,GAMEHOP-NODE-STYLE] {\@pcgamehophintbelow} (gamenode#1); \end{tikzpicture} \@pc@finalizegamehop } \newcommandx*{\addendgamehop}[2][1=\thepcgamecounter]{% \@pc@setupgamehop{#2} \begin{tikzpicture}[overlay] \node[right=\@pcgamehoplength of gamenode#1] (tmpgamenode#1) {}; \path[->,GAMEHOP-PATH-STYLE] (gamenode#1) edge[GAMEHOP-EDGE-STYLE] node[above,GAMEHOP-NODE-STYLE] {\@pcgamehophint} node[below,GAMEHOP-NODE-STYLE] {\@pcgamehophintbelow} (tmpgamenode#1); \end{tikzpicture} \@pc@finalizegamehop } \newcommandx*{\addbxgamehop}[3]{% \@pc@setupgamehop{#3} \begin{tikzpicture}[overlay] \path[->,GAMEHOP-PATH-STYLE] (bgamenode#1) edge[GAMEHOP-EDGE-STYLE] node[above,GAMEHOP-NODE-STYLE]] {\@pcgamehophint} node[below,GAMEHOP-NODE-STYLE] {\@pcgamehophintbelow} (bgamenode#2); \end{tikzpicture} \@pc@finalizegamehop } \newcommandx*{\addloopgamehop}[2][1=\thepcgamecounter]{% \@pc@setupgamehop{#2} \begin{tikzpicture}[overlay] \node (looptemp1) [right=0.5cm of gamenode#1] {}; \draw[->,GAMEHOP-PATH-STYLE] (gamenode#1) -- (looptemp1|-gamenode#1) -- node[right,GAMEHOP-NODE-STYLE] {\@pcgamehophint} node[left,GAMEHOP-NODE-STYLE] {\@pcgamehophintbelow} (looptemp1|-bgamenode#1)-- (bgamenode#1); \end{tikzpicture} \@pc@finalizegamehop } \newenvironment{gamedescription}[1][]{% \begingroup% \setkeys{pcgameproof}{#1} \renewcommand{\@withingamedescription}{true}% \@pc@ensureremember% \setcounter{pcgamecounter}{\@pcgameproofgamenr}% \setcounter{pcstartgamecounter}{\@pcgameproofgamenr}\stepcounter{pcstartgamecounter}% \begin{description}% }{\end{description}\@pc@releaseremember\endgroup} \newcommandx*{\describegame}[1][1=]{% \addtocounter{pcgamecounter}{1}% \item[% \pcdraw{ \gdef\i{\thepcgamecounter}% \node[inner sep=0.0em,outer sep=0, xshift=-1ex, yshift=0.5ex] (gamenode\i) {}; }% \@pc@gametitle:]% \begingroup\setkeys{pcgamehop}{#1}% \ifthenelse{\equal{}{\@pcgamehophint}} {} {\hspace{-0.7ex}\pcdraw{%the -0.7ex is a horrible hack to fix a whitespace issue with tikz (see http://tex.stackexchange.com/questions/22873/tikzpicture-with-overlay-takes-up-space \tikzset{GAMEHOP-PATH-STYLE/.style/.expand once=\@pcgamehoppathestyle}% \tikzset{GAMEHOP-NODE-STYLE/.style/.expand once=\@pcgamehopnodestyle}% \draw[->,GAMEHOP-PATH-STYLE] (gamenode\thepcgamecounter) --++ (0,-\@pcgamehoplength) node[midway,above,xshift=-1mm,rotate=90,GAMEHOP-NODE-STYLE] {\@pcgamehophint}; }}% \ifthenelse{\equal{}{\@pcgamehopinhint}} {} {\hspace{-0.7ex}\pcdraw{%the -0.7ex is a horrible hack to fix a whitespace issue with tikz (see http://tex.stackexchange.com/questions/22873/tikzpicture-with-overlay-takes-up-space \tikzset{GAMEHOP-PATH-STYLE/.style/.expand once=\@pcgamehoppathestyle}% \tikzset{GAMEHOP-NODE-STYLE/.style/.expand once=\@pcgamehopnodestyle}% \draw[<-,GAMEHOP-PATH-STYLE] (gamenode\thepcgamecounter) --++ (0,\@pcgamehoplength) node[midway,above,xshift=-1mm,rotate=90,GAMEHOP-NODE-STYLE] {\@pcgamehopinhint}; }% }% \endgroup% } \endinput %% %% End of file `cryptocode.sty'.