diff options
-rw-r--r-- | cameltris/piece.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cameltris/piece.py b/cameltris/piece.py index d0e97f6..d290815 100644 --- a/cameltris/piece.py +++ b/cameltris/piece.py @@ -37,6 +37,7 @@ class Piece: class ZPiece(Piece): + """ Represents a Z piece that has two positions """ def __init__(self): super().__init__() @@ -55,6 +56,8 @@ class ZPiece(Piece): self.rotate() def rotate(self): + """ Rotate the piece. For a Z piece, there is no difference between + clockwise and counter-clockwise. """ if self.vertical: self.set_elements_from_description([ (1, 1, 0), @@ -72,6 +75,9 @@ class ZPiece(Piece): class SPiece(Piece): + """ Represents a S piece that has technically three different positions. + After flipping the piece for the first time, it will move up one tile. + """ def __init__(self): super().__init__() @@ -90,6 +96,8 @@ class SPiece(Piece): self.rotate() def rotate(self): + """ Rotate the piece. For a S piece, there is no difference between + clockwise and counter-clockwise. """ if self.vertical: self.set_elements_from_description([ (0, 1, 1), @@ -107,6 +115,8 @@ class SPiece(Piece): class SquarePiece(Piece): + """ Represents a square piece (or O piece) that keeps the same position no + matter how may times it is rotated """ def __init__(self): super().__init__() @@ -118,6 +128,8 @@ class SquarePiece(Piece): class IPiece(Piece): + """ Represents a I piece (vertical bar) that can be in two different + positions """ def __init__(self): super().__init__() @@ -137,6 +149,8 @@ class IPiece(Piece): self.rotate() def rotate(self): + """ Rotate the piece. For an I piece, there is no difference between + clockwise and counter-clockwise. """ if self.vertical: self.set_elements_from_description([ (0, 0, 0, 0), @@ -156,6 +170,7 @@ class IPiece(Piece): class LPiece(Piece): + """ Represents a L piece that can take four different positions """ def __init__(self): super().__init__() @@ -168,6 +183,7 @@ class LPiece(Piece): class JPiece(Piece): + """ Represents a J piece that can take four different positions """ def __init__(self): super().__init__() @@ -180,6 +196,7 @@ class JPiece(Piece): class TPiece(Piece): + """ Represents a T piece that can take four different positions """ def __init__(self): super().__init__() |