<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\small
\begin{algorithmic}[1]
\label{alg_fturn_rstate}
  \Procedure{OnRunState()}{}

  \State $V$ $\gets$ updatePositions() \Comment{Step 1}

  \If{{\tt timeout} or {\tt turn\_complete}}   \Comment{Steps 2,3}
        \State postTurnFlags() \Comment{Step 4}
        \State postRunFlags() \Comment{Step 4}
        \State postEndFlags() \Comment{Step 4}
        \State {\bf return} 0
  \EndIf

  \If{{\tt turn} = {\tt port}}   \Comment{Step 5}
        \State $\theta_{sp}$ $\gets$ $\theta_{sp} - \theta_{\Delta}$ 
  \Else
        \State $\theta_{sp}$ $\gets$ $\theta_{sp} + \theta_{\Delta}$ 
  \EndIf

  \State $ipf$ $\gets$ buildIvPFunction($\theta_{sp}$)   \Comment{Step 6}
  \State postRunFlags() \Comment{Step 7}
  \State postActiveFlags() \Comment{Step 7}
  \State {\bf return} $ipf$
  \EndProcedure
\end{algorithmic}
\normalsize





</pre></body></html>