Hauptprogramm

class gropro.FileReader(input: Path)[Quellcode]

Bases: IReader

Reader implementation for a file-like object, provided at instantiation

read() list[str][Quellcode]

Executes the actual read operation, will fail for file-not existing, etc

class gropro.StreamReader(input: TextIO)[Quellcode]

Bases: IReader

Reader implementation for a text stream object, provided at instantiation

read() list[str][Quellcode]

Executes the actual read operation, if this is called and nothing is written to stdin, the programm will halt until interrupted by the user or OS.

class gropro.IReader[Quellcode]

Bases: ABC

abstract read() list[str][Quellcode]
class gropro.FileWriter(file: Path)[Quellcode]

Bases: IWriter

Writes to a specified file, relative and absolute paths are possible.

write(content: list[str])[Quellcode]

Performs the actual filesystem operation, will throw any access error or similar

writecheck() bool[Quellcode]
class gropro.StreamWriter[Quellcode]

Bases: IWriter

Writes directly to stdout, may be piped or redirected in most shells.

write(content: list[str])[Quellcode]
writecheck() bool[Quellcode]
class gropro.IWriter[Quellcode]

Bases: ABC

Abstraktion für Ausgabe Operationen

abstract write(content: list[str])[Quellcode]
abstract writecheck() bool[Quellcode]
class gropro.Puzzle(teile: list[gropro.teil.Teil], dimension: tuple[int, int, int], header: list[str], ebenen: list[gropro.ebene.Ebene] = <factory>)[Quellcode]

Bases: object

teile: list[Teil]
dimension: tuple[int, int, int]
header: list[str]
ebenen: list[Ebene]
to_repr_list()[Quellcode]

Schreibe die Repräsentation gemäß der Aufgabenstellung

gropro.load_puzzle(input: IReader) Puzzle[Quellcode]
  • Nimm die Eingabedaten entgegen

  • Validiere die Eingabedaten

  • Erzeuge Repräsentative Datenmodelle

  • Sammle alle korrekt definierten Daten in einer Puzzle Instanz

class gropro.PuzzleSolver(puzzle: Puzzle)[Quellcode]

Bases: object

puzzle: Puzzle
solve() tuple[bool, int][Quellcode]

Wrapper für die Backtracking Implementation - Initialisiere anhand des übergebenen Puzzle - Lege die erste, leere Ebene ohne Vorgänger an - Sortiere die Puzzleteile - Starte das Backtracking - Ordne alle Ebenen die zu der Lösung führen dem Puzzle zu

class gropro.Teil(name: str, elemente: list[gropro.element.Element], operations: list[gropro.operation.IOperation] = <factory>)[Quellcode]

Bases: object

name: str
elemente: list[Element]
operations: list[IOperation]
reset()[Quellcode]
manipulate(op: IOperation)[Quellcode]
property value: list[int]
  • Ermittle eine integer-basierte Repräsentation aller Elemente

  • Berücksichtige alle Manipulationen

class gropro.Ebene(dimension: int, teile: list[gropro.teil.Teil] = <factory>, lower: Optional[ForwardRef('Ebene')] = None, quer: bool = False)[Quellcode]

Bases: object

dimension: int
teile: list[Teil]
lower: Ebene | None = None
quer: bool = False
property voll: bool
property depth: int
add(t: Teil) bool[Quellcode]

Füge ein zulässiges Teil in die nächste Freie Position ein oder melde Unzulässigkeit

fits(t: Teil) bool[Quellcode]

Weise unzulässige Teile für die nächste freie Position ab

class gropro.Element(value: int)[Quellcode]

Bases: object

Halte den Wert eines Puzzleelements

value: int
classmethod flip(i: int)[Quellcode]
class gropro.Invert[Quellcode]

Bases: IOperation

act(el: list[int]) list[int][Quellcode]
class gropro.Rotate[Quellcode]

Bases: IOperation

act(el: list[int]) list[int][Quellcode]