Пример #1
0
    def __init__(self, prototile, cCurve):
        self.prototile = prototile
        AutoTiler.__init__(self, SimplePatch(), PrototileSet(prototile))
        self.n = self.prototile.getSymmetryGroup().getRotationalSymmetry() / 2
        self.fittingTiler = FittingTiler(self.patch, self.prototileSet)

        if cCurve:
            self.a = SymbolicTransform(self.prototile.getSymmetryGroup())
            self.b = SymbolicTransform(self.prototile.getSymmetryGroup()).reflect().rotate(-2)
            self.c = SymbolicTransform(self.prototile.getSymmetryGroup()).reflect().rotate(-1)
            self.d = SymbolicTransform(self.prototile.getSymmetryGroup()).rotate(-1)
        else:
            self.a = SymbolicTransform(self.prototile.getSymmetryGroup())
            self.b = SymbolicTransform(self.prototile.getSymmetryGroup()).rotate(self.n - 1)
            self.c = SymbolicTransform(self.prototile.getSymmetryGroup()).rotate(self.n)
            self.d = SymbolicTransform(self.prototile.getSymmetryGroup()).rotate(-1)

        self.step1 = 1
        self.black1 = 0

        self.step2 = 1
        self.black2 = 1

        tile = self.prototile.getTransformedTile(self.a)
        self.black1 = self.setTileColour(tile, self.black1)
        self.a.rotate(-1)
        self.patch.add(tile)
        self.currentSide1 = self.patch.getSides().get(self.patch.getSideIndex() + 2)

        tile = self.prototile.getTransformedTile(self.c)
        tile = self.fittingTiler.getFittingTile(0, tile, 0)
        self.black2 = self.setTileColour(tile, self.black2)
        self.c.rotate(-1)
        self.patch.add(tile)
        self.currentSide2 = self.patch.getSides().get(self.patch.getSideIndex() + 1)
Пример #2
0
 def __init__(self, prototileSet):
   AutoTiler.__init__(self, SimplePatch(), prototileSet)
   self.random = Random()
   self.fittingTiler = FittingTiler(self.patch, prototileSet)
   allTiles = prototileSet.getAllTiles()
   self.patch.add(allTiles.get(self.random.nextInt(allTiles.size())))