# Path: wordclock_plugins/tetris/brick.py
# class brick:
#     def __init__(self, layout, color):
#         self.layout = copy.deepcopy(layout)
#         self.color = color
#         self.outerHeight = len(layout)
#         self.outerWidth = len(layout[0])
# 
#         self.padTop = padTop(layout)
#         self.padBottom = padTop(layout[::-1])
#         rl = rot_left(layout)
#         self.padLeft = padTop(rl)
#         self.padRight = padTop(rl[::-1])
# 
#         self.innerHeight = self.outerHeight - self.padTop - self.padBottom
#         self.innerWidth = self.outerWidth - self.padLeft - self.padRight
# 
#     def clone(self):
#         return brick(self.layout, self.color)
# 
#     def rotate_cw(self):
#         return brick(rot_left(self.layout), self.color)
# 
#     def rotate_ccw(self):
#         return brick(rot_right(self.layout), self.color)


import os
import wordclock_tools.wordclock_colors as wcc
import random
import time
from .brick import brick
from time import sleep
from functools import reduce
                        else:
                            wcd.setColorBy2DCoordinates(c, r,
                                                        cell.color if cell is not None else self.bg_color)
                # redraw
                wcd.show()
                sleep(0.3)
        for row in rows:  # clear lines
            for k in reversed(list(range(row))):
                self.field[k + 1] = self.field[k][:]
        self.draw(wcd)
        return len(rows)

    def gameover(self, wcd):
        for k in range(10):  # blink all lines 5 times
            for r, row in enumerate(self.field):
                for c, cell in enumerate(row):
                    if k % 2 == 0:
                        wcd.setColorBy2DCoordinates(c, r, self.bg_color)
                    else:
                        wcd.setColorBy2DCoordinates(c, r, cell.color if cell is not None else self.bg_color)
            wcd.show()
            sleep(0.3)

    def draw(self, wcd):
        # redraw field
        for r, row in enumerate(self.field):
            for c, cell in enumerate(row):
                wcd.setColorBy2DCoordinates(c, r, cell.color if cell is not None else self.bg_color)
        wcd.show()


# Path: wordclock_plugins/tetris/brick.py
# class brick:
#     def __init__(self, layout, color):
#         self.layout = copy.deepcopy(layout)
#         self.color = color
#         self.outerHeight = len(layout)
#         self.outerWidth = len(layout[0])
# 
#         self.padTop = padTop(layout)
#         self.padBottom = padTop(layout[::-1])
#         rl = rot_left(layout)
#         self.padLeft = padTop(rl)
#         self.padRight = padTop(rl[::-1])
# 
#         self.innerHeight = self.outerHeight - self.padTop - self.padBottom
#         self.innerWidth = self.outerWidth - self.padLeft - self.padRight
# 
#     def clone(self):
#         return brick(self.layout, self.color)
# 
#     def rotate_cw(self):
#         return brick(rot_left(self.layout), self.color)
# 
#     def rotate_ccw(self):
#         return brick(rot_right(self.layout), self.color)


# Path: wordclock_plugins/tetris/plugin.py
import os
import wordclock_tools.wordclock_colors as wcc
import random
import time
from .brick import brick
from time import sleep
from functools import reduce

                        else:
                            wcd.setColorBy2DCoordinates(c, r,
                                                        cell.color if cell is not None else self.bg_color)
                # redraw
                wcd.show()
                sleep(0.3)
        for row in rows:  # clear lines
            for k in reversed(list(range(row))):
                self.field[k + 1] = self.field[k][:]
        self.draw(wcd)
        return len(rows)

    def gameover(self, wcd):
        for k in range(10):  # blink all lines 5 times
            for r, row in enumerate(self.field):
                for c, cell in enumerate(row):
                    if k % 2 == 0:
                        wcd.setColorBy2DCoordinates(c, r, self.bg_color)
                    else:
                        wcd.setColorBy2DCoordinates(c, r, cell.color if cell is not None else self.bg_color)
            wcd.show()
            sleep(0.3)

    def draw(self, wcd):
        # redraw field
        for r, row in enumerate(self.field):
            for c, cell in enumerate(row):
                wcd.setColorBy2DCoordinates(c, r, cell.color if cell is not None else self.bg_color)
        wcd.show()


    def carve(self, brick, x, y):