diff --git a/Projektgruppe_175/src/game/map/GameMap.java b/Projektgruppe_175/src/game/map/GameMap.java index 494b896..c4a4167 100644 --- a/Projektgruppe_175/src/game/map/GameMap.java +++ b/Projektgruppe_175/src/game/map/GameMap.java @@ -151,7 +151,16 @@ public class GameMap { * jede Burg mit allen anderen in einem bestimmten Radius nochmals verbunden */ private void generateEdges() { - // TODO: GameMap#generateEdges() + + List> castleNodes = castleGraph.getNodes(); + + for (int i = 0; i < castleNodes.size(); i++) { + if (i == castleNodes.size() - 1) + castleGraph.addEdge(castleNodes.get(i), castleNodes.get(0)); + else + castleGraph.addEdge(castleNodes.get(i), castleNodes.get(i+1)); + } + } /** diff --git a/doc/Dokumentation.tex b/doc/Dokumentation.tex index 8fefcce..cafd0e0 100644 --- a/doc/Dokumentation.tex +++ b/doc/Dokumentation.tex @@ -31,27 +31,13 @@ \caption{Bildung von Kanten}\label{euclid} \begin{algorithmic}[1] \Procedure{generateEdges}{} - \State $\textit{firstNode} \gets \text{first element of }\textit{nodes}$ - \State $allVisitedNodes \gets \textit{empty}$ - \State $nextVisitNodes \gets empty$ - \State $\text{append } firstNode \text{ to } allVisitedNodes$ - \State $\text{neighborsOf } firstNode$ - \State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$ - \State $\rightarrow \text{append to } nextVisitNodes$ - \BState \emph{loop} - \If {$nextVisitNodes \text{ is empty}$} - break - \EndIf - \State $\text{neighborsOf first element of } nextVisitNodes$ - \State $\rightarrow \text{filter out all } x \text{ where } allVisitedNodes \text{ contains } x$ - \State $\rightarrow \text{append to } nextVisitNodes$ - \State $\text{append first element of } nextVisitNodes \text{ to } allVisitedNodes$ - \State $\text{delete first element of } nextVisitNodes$ - \BState \emph{end loop} \EndProcedure \end{algorithmic} \end{algorithm} + % Erklärung des Algorithmus + + \subsection{Überprüfung der Erreichbarkeit aller Knoten} Der Algorithmus, der prüft, ob alle Knoten erreichbar sind, ist @@ -97,5 +83,9 @@ Nachbarn, die schon in der Liste \texttt{allVisitedNodes} vorhanden sind, werden verworfen. Die restlichen Nachbarn werden der Liste \texttt{nextVisitNodes} hinzugefügt. + + \subsection{Wege finden} + + \subsection{Kürzester Pfad zu allen Knoten} \end{document}