Пример #1
0
 public bool CheckForCollisions(Polymino poly)
 {
     foreach (Cell cl1 in cells)
     {
         foreach (Cell cl2 in poly.cells)
         {
             if (cl1.Coordinate.x == cl2.Coordinate.x && cl1.Coordinate.y == cl2.Coordinate.y)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Пример #2
0
    public Polymino CreatePolymino(int n, Coordinate coord)
    {
        bool     output  = false;
        Polymino outPoly = new Polymino();

        while (!output)
        {
            output  = true;
            outPoly = new Polymino(n, coord);
            foreach (Polymino poly2 in polyminos)
            {
                if (outPoly.CheckForCollisions(poly2))
                {
                    output = false;
                    outPoly.del();
                }
            }
        }
        return(outPoly);
    }