Ejemplo n.º 1
0
    def test_j_as_shape(self):

        block = Tetromino("J")
        self.assertEqual(block.as_shape(), [
            [0, 1, 1, 0],
            [0, 1, 0, 0],
            [0, 1, 0, 0],
            [0, 0, 0, 0],
        ])
        block.rotate()
        self.assertEqual(block.as_shape(), [
            [1, 0, 0, 0],
            [1, 1, 1, 0],
            [0, 0, 0, 0],
            [0, 0, 0, 0],
        ])
        block.rotate()
        self.assertEqual(block.as_shape(), [
            [0, 1, 0, 0],
            [0, 1, 0, 0],
            [1, 1, 0, 0],
            [0, 0, 0, 0],
        ])
        block.rotate()
        self.assertEqual(block.as_shape(), [
            [0, 0, 0, 0],
            [1, 1, 1, 0],
            [0, 0, 1, 0],
            [0, 0, 0, 0],
        ])
Ejemplo n.º 2
0
 def test_s_as_shape(self):
     block = Tetromino("S")
     self.assertEqual(
         block.as_shape(),
         [[0, 0, 0, 0], [0, 0, 1, 1], [0, 1, 1, 0], [0, 0, 0, 0]])
     block.rotate()
     self.assertEqual(
         block.as_shape(),
         [[0, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 0], [0, 0, 0, 0]])