Skip to content
Snippets Groups Projects
Commit 57021e31 authored by Jessica Dreyer's avatar Jessica Dreyer
Browse files

Comments / Documentation added

parent 17793484
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,19 @@ from PuzzlePiece import PuzzlePiece
from Side import Side
class MatchingCounterpiece:
"""
A class used to represent a matching counterpiece to a puzzle piece and one of its sides.
Attributes
----------
__piece : PuzzlePiece
puzzle piece
__side : Side
side
__distance : int
distance to the other puzzle piece and side
"""
def __init__(self, piece: PuzzlePiece, side: Side, distance):
self.__piece = piece
......
......@@ -23,11 +23,20 @@ class Puzzle:
__size : np.array
an array that cointains the width and length and represents
the size of the puzzle
__width : int
the width of the puzzle
__height : int
the height of the puzzle
__pieces : np.array
an array that contains all the puzzle pieces
Methods
-------
set_piece(piece : PuzzlePiece, idx : int)
get_edge_pieces(is_sorted : bool) : np.array
get_inner_pieces(is_sorted : bool) : np.array
get_corners(is_sorted : bool) : np.array
"""
def __init__(self, width, height):
......@@ -61,7 +70,7 @@ class Puzzle:
return self.__pieces
def set_pieces(self, pieces):
self.__pieces = pieces #np.reshape(pieces, (self.__size))
self.__pieces = pieces
def set_piece(self, piece: PuzzlePiece, idx):
"""
......
......@@ -52,6 +52,8 @@ class PuzzlePiece:
Methods
-------
rotate(top_side : int) : None
"""
def __init__(self, id, category: Category, number_of_holes, number_of_heads, image_path, sides = np.array):
......
......@@ -15,7 +15,19 @@ from Side import SideType
from MatchingCounterpiece import MatchingCounterpiece
class PuzzleSolver:
"""
A class used to represent the puzzle solver.
Methods
-------
get_compatible_side_type(side_type : SideType) : SideType
get_possible_sides(piece : PuzzlePiece, current_side : Side, idx_possible_side : int) : np.array
find_compatible(current_piece : PuzzlePiece, current_side : Side, possible_pieces : np.array, idx_help : int) : (PuzzlePiece, Side)
solve(puzzle : Puzzle) : Puzzle
"""
@staticmethod
def get_compatible_side_type(side_type: SideType):
"""
Determines the compatible side type to a given side type.
......@@ -49,7 +61,7 @@ class PuzzleSolver:
puzzle piece for which the possible sides are to be found
current_side : Side
side of the current piece that is being considered
idx_possible_side : TYPE
idx_possible_side : int
auxiliary index for determining the possible side(s)
Returns
......
......@@ -39,9 +39,10 @@ class Side:
an array that contains the outline of the side
__width : int
the width of the side
Methods
-------
__height : int
the height of the side
__is_sorted : bool
decides if the side is already sorted
"""
......@@ -56,6 +57,8 @@ class Side:
an array that contains the outline of the side
width : int
the width of the side
height : int
the height of the side
"""
self.__id = id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment