From 8c85e3cce9e00f4da531fb1bc709b7132916a8eb Mon Sep 17 00:00:00 2001 From: Jannik Dunkelau <jannik.dunkelau@hhu.de> Date: Wed, 12 Feb 2020 11:07:50 +0100 Subject: [PATCH] Fix some kerning in example algorithm --- contents.tex | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/contents.tex b/contents.tex index 8ed19ab..e0b3dd8 100644 --- a/contents.tex +++ b/contents.tex @@ -170,32 +170,35 @@ Minimax-Algorithmus aufgeführt. \begin{algorithmic}[1] \Function{Minimax}{Game State Tree: $G^n$} \State bestValue \(\gets -\infty\) - \State \(bestAction \gets \) NIL + \State \(\mathit{bestAction} \gets \) NIL \ForAll{\(G^n_a \in S(G^n)\)} - \State \(value = \) \Call{MinimaxValue}{\(G^n_a\), true} - \If{\(value > bestValue\)} \Comment{Aktualisiere besten Wert} - \State \(bestValue \gets value\) - \State \(bestAction \gets a\) + \State \(\mathit{value} = \) \Call{MinimaxValue}{\(G^n_a\), true} + \If{\(\mathit{value} > \mathit{bestValue}\)} + \Comment{Aktualisiere besten Wert} + \State \(\mathit{bestValue} \gets \mathit{value}\) + \State \(\mathit{bestAction} \gets a\) \EndIf \EndFor - \State \Return \(bestAction\) + \State \Return \(\mathit{bestAction}\) \EndFunction \Statex - \Function{MinimaxValue}{Game State Tree: $G^n$ Boolean: $ourTurn$} + \Function{MinimaxValue}{Game State Tree: $G^n$, Boolean: $\mathit{ourTurn}$} \If{\(D(G^n)=0\)} \State \Return \Call{Heuristic}{root(\(G^n\))} - \ElsIf{\(ourTurn\)} - \State \(maxValue \gets -\infty \) + \ElsIf{\(\mathit{ourTurn}\)} + \State \(\mathit{maxValue} \gets -\infty \) \ForAll{\(S \in S(G^n)\)} - \State \(newValue \gets \) \Call{MinimaxValue}{\(S\), false} - \State \(maxValue \gets max(newValue, maxValue)\) + \State \(\mathit{newValue} \gets \) \Call{MinimaxValue}{\(S\), false} + \State \(\mathit{maxValue} \gets + \max(\mathit{newValue}, \mathit{maxValue})\) \EndFor \State \Return \(maxValue\) \Else \State \(minValue \gets +\infty \) \ForAll{\(S \in S(G^n)\)} - \State \(newValue \gets \) \Call{MinimaxValue}{\(S\), true} - \State \(minValue \gets \min(newValue, minValue)\) + \State \(\mathit{newValue} \gets \) \Call{MinimaxValue}{\(S\), true} + \State \(\mathit{minValue} \gets + \min(\mathit{newValue}, \mathit{minValue})\) \EndFor \State \Return \(minValue\) \EndIf -- GitLab