diff --git a/contents.tex b/contents.tex index 8ed19abde229028c045e3f0ae334f2ba00e19af6..e0b3dd80f1e11ec00ed96f9a3235f249a6cd874b 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