From 1da4e51467c229fc4f2b122d9a6dbaa8a666b408 Mon Sep 17 00:00:00 2001 From: Alfred Baumann Date: Mon, 8 Jun 2026 09:19:48 +0000 Subject: [PATCH] Update Algorithmen/Brute Force --- Algorithmen%2FBrute-Force.md | 50 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/Algorithmen%2FBrute-Force.md b/Algorithmen%2FBrute-Force.md index a5adabf..80d2ea8 100644 --- a/Algorithmen%2FBrute-Force.md +++ b/Algorithmen%2FBrute-Force.md @@ -1,24 +1,26 @@ -# Beschreibung - -Dieses Algorithmus löst das Spiel, indem es jede einzelne möglichkeit -ausprobiert, bis es die lösung findet. Das macht es, indem es das erste Feld -dreht und wenn es dann in seine ursprüngliche richtung zeigt, wird das nächste -auch gedreht. Dies kann man auch sehen als ein Aufzählen einer base-4 Nummer, wo -jede Stelle die Rotation einer Zelle festlegt. - -# Pseudocode - -``` -# Setup -for piece in board: - piece.direction = up - -board[0][0].rotate_cw() -prev = board[0][0] -for piece in board[1:]: - if prev.direction = up: - piece.rotate_cw() - else: - break -``` - +# Beschreibung + +Dieses Algorithmus löst das Spiel, indem es jede einzelne möglichkeit +ausprobiert, bis es die lösung findet. Das macht es, indem es das erste Feld +dreht und wenn es dann in seine ursprüngliche richtung zeigt, wird das nächste +auch gedreht. Dies kann man auch sehen als ein Aufzählen einer base-4 Nummer, wo +jede Stelle die Rotation einer Zelle festlegt. + +# Pseudocode + +``` +# Setup +for piece in board: + piece.direction = up + +# Lösen +while not solved: + board[0][0].rotate_cw() + prev = board[0][0] + for piece in board[1:]: + if prev.direction == up: + piece.rotate_cw() + else: + break +``` +