Example #1
0
 static void ClaimFabric(FabricPart part, Dictionary <string, int> claimsDict)
 {
     for (int x = 0; x < part.Width; x++)
     {
         for (int y = 0; y < part.Height; y++)
         {
             if (!claimsDict.ContainsKey(GetKey(part, x, y)))
             {
                 claimsDict.Add(GetKey(part, x, y), 1);
             }
             else
             {
                 claimsDict[GetKey(part, x, y)]++;
             }
         }
     }
 }
Example #2
0
        static void ClaimFabric(FabricPart part, Dictionary <string, int> claimsDict, Dictionary <int, List <string> > fabricPieces)
        {
            var pieceList = new List <string>();

            fabricPieces.Add(part.Id, pieceList);
            for (int x = 0; x < part.Width; x++)
            {
                for (int y = 0; y < part.Height; y++)
                {
                    pieceList.Add(GetKey(part, x, y));
                    if (!claimsDict.ContainsKey(GetKey(part, x, y)))
                    {
                        claimsDict.Add(GetKey(part, x, y), 1);
                    }
                    else
                    {
                        claimsDict[GetKey(part, x, y)]++;
                    }
                }
            }
        }
Example #3
0
 static string GetKey(FabricPart part, int x, int y)
 {
     return($"{x + part.Left}&&{y + part.Top}");
 }