Example #1
0
        protected void CreateBlobs()
        {
            this.BlobMap = new Dictionary <District, CreateContinents.Blob>();
            List <District> list = new List <District>(from d in base.Context.Districts.Values
                                                       where d.Content != District.Contents.WasteNS
                                                       where d.Content != District.Contents.WasteEW
                                                       select d);
            AdHocGraph <District>    graph         = new AdHocGraph <District>(list);
            RandomScatter <District> randomScatter = new RandomScatter <District>(graph);

            randomScatter.Randomizer = base.Context.Randomizer;
            randomScatter.Shots      = Math.Min(list.Count, 500);
            randomScatter.Execute();
            SeedGrower <District, CreateContinents.Blob> seedGrower = new SeedGrower <District, CreateContinents.Blob>(graph)
            {
                Randomizer = base.Context.Randomizer,
                Blank      = null
            };

            foreach (District key in randomScatter.Impacts)
            {
                seedGrower.Seeds.Add(key, new CreateContinents.Blob(this.BlobMap));
            }
            seedGrower.Execute();
            for (int i = 0; i < seedGrower.Graph.Nodes; i++)
            {
                District district          = seedGrower.Graph.Node(i);
                CreateContinents.Blob blob = seedGrower.SeededGraph[i];
                this.BlobMap.Add(district, blob);
                blob.Districts.Add(district);
            }
            this.CoreBlobs = new List <CreateContinents.Blob>(this.BlobMap.Values.Distinct <CreateContinents.Blob>());
        }
Example #2
0
 public Continent(AdHocGraph <CreateContinents.Blob> graph)
 {
     this.Graph        = graph;
     this.Blobs        = new HashSet <CreateContinents.Blob>();
     this.Influence    = new HashSet <CreateContinents.Blob>();
     this.Growth       = new HashSet <CreateContinents.Blob>();
     this.ProxBlober   = new ProximityComputer <CreateContinents.Blob>(this.Graph);
     this.RelativeSize = 100;
     this.Id           = ++CreateContinents.Continent.CurrentId;
 }