Beispiel #1
0
    def __init__(self):
        def position(block):
            '''
            position generator: for convenience, it draws in a 6 x 6
            block which we then position into the frame.
            '''
            while True:
                for x in range(6):
                    for y in range(5):          # snake
                        block.fill(LampState.OFF)
                        if x % 2 == 0:          # snake up
                            block.setLamp(x, 4 - y, LampState.ON)
                            yield None
                        else:                   # snake down
                            block.setLamp(x, y, LampState.ON)
                            yield None

                for x in range(6):
                    block.fill(LampState.OFF).setLamp(5 - x, 5, LampState.ON)
                    yield None

        Tile.__init__(self, 3)
        b = Block(6, 6)
        self.__gen = position(b)
        self.getFrame().add(b, 1, 1)
Beispiel #2
0
    def __init__(self, size):
        Tile.__init__(self)
        frame = self.getFrame()

        # Underlying pattern:
        b = Block(size, size).fill(LampState.ON)

        i = 0
        n = 0
        while i < 8:
            j = 0
            while j < 8:
                if n % 2 == 0: frame.add(ViewPort(b, 0, 0, size, size), i, j)
                n += 1
                j += size

            i += size
            n += 1

        # Top layer which we flip:
        b = Block(8, 8).fill(LampState.FLIP)
        frame.add(b, 0, 0)

        def tick():
            while True:
                frame.hide(b)
                yield None
                frame.show(b)
                yield None
    
        self.__ticker = tick()
Beispiel #3
0
    def __init__(self):
        def position(block):
            '''
            position generator: for convenience, it draws in a 6 x 6
            block which we then position into the frame.
            '''
            while True:
                for x in range(6):
                    for y in range(5):  # snake
                        block.fill(LampState.OFF)
                        if x % 2 == 0:  # snake up
                            block.setLamp(x, 4 - y, LampState.ON)
                            yield None
                        else:  # snake down
                            block.setLamp(x, y, LampState.ON)
                            yield None

                for x in range(6):
                    block.fill(LampState.OFF).setLamp(5 - x, 5, LampState.ON)
                    yield None

        Tile.__init__(self, 3)
        b = Block(6, 6)
        self.__gen = position(b)
        self.getFrame().add(b, 1, 1)
Beispiel #4
0
    def __init__(self, interval=10, limit=10):
        Tile.__init__(self, interval, limit)
        b = Block(8, 8).fill(LampState.FLIP)

        self.__masterFrame = Frame()
        self.__masterFrame.add(self.getFrame(), 0, 0).add(b, 0, 0).hide(b)
        self.__flipped = False
        self.__flipper = b
    def __init__(self):
        Tile.__init__(self, 5)
        block = Block(4, 4)

        f = self.getFrame()
        f.add(ViewPort(block, 0, 0, 4, 4), 0, 0)
        f.add(ViewPort(block, 0, 0, 4, 4), 4, 0)
        f.add(ViewPort(block, 0, 0, 4, 4), 0, 4)
        f.add(ViewPort(block, 0, 0, 4, 4), 4, 4)
        f.add(ViewPort(block, 0, 0, 4, 4), 2, 2)

        self.__block = block
        self.__pos = 0
Beispiel #6
0
    def __init__(self):
        Tile.__init__(self, 5)
        block = Block(4, 4)

        f = self.getFrame()
        f.add(ViewPort(block, 0, 0, 4, 4), 0, 0)
        f.add(ViewPort(block, 0, 0, 4, 4), 4, 0)
        f.add(ViewPort(block, 0, 0, 4, 4), 0, 4)
        f.add(ViewPort(block, 0, 0, 4, 4), 4, 4)
        f.add(ViewPort(block, 0, 0, 4, 4), 2, 2)

        self.__block = block
        self.__pos = 0
    def __init__(self):
        Tile.__init__(self, 1, 1)
        self.__random = Random()
        b = Block(8, 8)

        for i in range(0, 8):
            for j in range(0, 8):
                if self.__random.nextBoolean():
                    b.setLamp(i, j, LampState.ON)
                else:
                    b.setLamp(i, j, LampState.OFF)

        self.getFrame().add(b, 0, 0)
        self.__block = b
Beispiel #8
0
    def __init__(self):
        Tile.__init__(self)
        letters = [
            '00000011 00000000 00000000 00000000 00000000 00000000 00000000 00000000', # ---
            '00000000 00000011 00000000 00000000 00000000 00000000 00000000 00000000', # ---
            '10001000 11011000 10101011 10101000 10001000 10001000 10001000 00000000', # M
            '01110000 10001000 10001000 10001011 10001000 10001000 01110000 00000000', # O
            '10001000 11001000 10101000 10011000 10001011 10001000 10001000 00000000', # N
            '01110000 10001000 10001000 10001000 10001000 10001011 01110000 00000000', # O
            '10001000 11011000 10101000 10101000 10001000 10001000 10001011 00000000', # M
            '11111000 10000000 10000000 11110000 10000000 10000000 11111000 00000011'  # E
        ]

        f = self.getFrame()
        self.__blocks = [Block(letters[i]) for i in range(8)]
        for b in self.__blocks: f.add(b, 0, 0)
Beispiel #9
0
    def __init__(self):
        Tile.__init__(self)
        letters = [
            '00000011 00000000 00000000 00000000 00000000 00000000 00000000 00000000',  # ---
            '00000000 00000011 00000000 00000000 00000000 00000000 00000000 00000000',  # ---
            '10001000 11011000 10101011 10101000 10001000 10001000 10001000 00000000',  # M
            '01110000 10001000 10001000 10001011 10001000 10001000 01110000 00000000',  # O
            '10001000 11001000 10101000 10011000 10001011 10001000 10001000 00000000',  # N
            '01110000 10001000 10001000 10001000 10001000 10001011 01110000 00000000',  # O
            '10001000 11011000 10101000 10101000 10001000 10001000 10001011 00000000',  # M
            '11111000 10000000 10000000 11110000 10000000 10000000 11111000 00000011'  # E
        ]

        f = self.getFrame()
        self.__blocks = [Block(letters[i]) for i in range(8)]
        for b in self.__blocks:
            f.add(b, 0, 0)
Beispiel #10
0
    def __init__(self):
        Tile.__init__(self, 3)

        def position(border):
            while True:
                for i in range(1 + border, 8 - border): yield (i, border)
                for i in range(1 + border, 8 - border): yield (7 - border, i)
                for i in range(1 + border, 8 - border): yield (7 - i, 7 - border)
                for i in range(1 + border, 8 - border): yield (border, 7 - i)

        self.__gens = []

        for i in range(4):
            self.__gens.append(position(i))

        self.__bloc = Block(8, 8)
        self.getFrame().add(self.__bloc, 0, 0)
Beispiel #11
0
    def __init__(self):
        Tile.__init__(self, 10, 100)
        digits = [
            '111 101 101 101 111', '110 010 010 010 010',
            '111 001 111 100 111', '111 001 111 001 111',
            '101 101 111 001 001', '111 100 111 001 111',
            '111 100 111 101 111', '111 001 001 001 001',
            '111 101 111 101 111', '111 101 111 001 111'
        ]

        lftBlocks = [Block(digits[i]) for i in range(10)]
        rhtBlocks = [Block(digits[i]) for i in range(10)]

        f = self.getFrame()

        for i in range(10):
            f.add(lftBlocks[i], 0, 0).add(rhtBlocks[i], 5, 0)

        self.__lftBlocks = lftBlocks
        self.__rhtBlocks = rhtBlocks
Beispiel #12
0
    def __init__(self):
        Tile.__init__(self, 3)

        def position(border):
            while True:
                for i in range(1 + border, 8 - border):
                    yield (i, border)
                for i in range(1 + border, 8 - border):
                    yield (7 - border, i)
                for i in range(1 + border, 8 - border):
                    yield (7 - i, 7 - border)
                for i in range(1 + border, 8 - border):
                    yield (border, 7 - i)

        self.__gens = []

        for i in range(4):
            self.__gens.append(position(i))

        self.__bloc = Block(8, 8)
        self.getFrame().add(self.__bloc, 0, 0)
Beispiel #13
0
    def __init__(self):
        Tile.__init__(self, 10, 100)
        digits = ['111 101 101 101 111',
                  '110 010 010 010 010',
                  '111 001 111 100 111',
                  '111 001 111 001 111',
                  '101 101 111 001 001',
                  '111 100 111 001 111',
                  '111 100 111 101 111',
                  '111 001 001 001 001',
                  '111 101 111 101 111',
                  '111 101 111 001 111'
                 ]

        lftBlocks = [Block(digits[i]) for i in range(10)]
        rhtBlocks = [Block(digits[i]) for i in range(10)]

        f = self.getFrame()

        for i in range(10):
            f.add(lftBlocks[i], 0, 0).add(rhtBlocks[i], 5, 0)

        self.__lftBlocks = lftBlocks
        self.__rhtBlocks = rhtBlocks
 def __init__(self, interval=10, limit=10):
     Tile.__init__(self, interval, limit)
Beispiel #15
0
 def __init__(self, interval=10, limit=10):
     Tile.__init__(self, interval, limit)