テトリミノの盤面を構成する

class Tray:
    def _tiles(self):
        ...
        s = {}
        for x, y in [(e*m1+2, 0) for e in range(5)]:
            for _ in range(3):
                s[x, y] = Tile(x, y); y += m2
        for x, y in [(e*m1+3, 2) for e in range(4)]:
            for _ in range(2):
                s[x, y] = Tile(x, y); y += m2
        return s

    def _edges(self, x):
        ...
        s = {}
        for x, y in [(x-1, e*m) for e in range(5)]:
            for _ in range(3):
                s[x, y] = Edge(x, y); x += 1
        return s

新たなテストケースの下地となる盤面(トレイ)を構成します。テトリミノが自由に移動できる境界内には Tile を敷き詰め、その境界外には Edge を敷き詰めます。

class Ostone(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.shape = self._shape()

    def _shape(self):
        M = 2
        Ox = HexStone._dx; W = HexStone._width
        Oy = HexStone._dy; H = HexStone._height
        X = Ox + W*self.x
        Y = Oy + H*self.y

        points = self.pointCollection([Point(X + dx*M, Y + dy*M)
            for dx, dy in HexStone(X, Y, False).vertices])
        return Polygon(
            HorizontalAlignment=HorizontalAlignment.Center,
            VerticalAlignment=VerticalAlignment.Center,
            Stroke=self._strokeColor,
            Points=points,
            )

Tile/Edge に共通する特性(座標や6角形の形状など)を規定します。

class Tile(Ostone):
    def __init__(self, x, y):
        self._strokeColor = Brushes.Gray
        super(self.__class__, self).__init__(x, y)

class Edge(Ostone):
    def __init__(self, x, y):
        self._strokeColor = Brushes.LightGray
        super(self.__class__, self).__init__(x, y)

Tile/Edge に固有の特性を規定します。このテストケースでは、輪郭の色の違いを設定するだけです。