public DungeonGeneratorConfiguration <TNode> SmartClone() { return(new DungeonGeneratorConfiguration <TNode>() { RoomsCanTouch = RoomsCanTouch, EarlyStopIfIterationsExceeded = EarlyStopIfIterationsExceeded, EarlyStopIfTimeExceeded = EarlyStopIfTimeExceeded, RepeatModeOverride = RepeatModeOverride, ThrowIfRepeatModeNotSatisfied = ThrowIfRepeatModeNotSatisfied, ChainDecompositionConfiguration = ChainDecompositionConfiguration.SmartClone(), Chains = Chains?.Select(x => new Chain <TNode>(x.Nodes.ToList(), x.Number)).ToList(), SimulatedAnnealingConfiguration = SimulatedAnnealingConfiguration.SmartClone(), SimulatedAnnealingMaxBranching = SimulatedAnnealingMaxBranching, }); }
private IMutation <TConfiguration> GetMutation(int priority, int maxTreeSize, bool mergeSmallChains, bool startTreeWithMultipleVertices, TreeComponentStrategy treeComponentStrategy) { var configuration = new ChainDecompositionConfiguration() { MaxTreeSize = maxTreeSize, MergeSmallChains = mergeSmallChains, StartTreeWithMultipleVertices = startTreeWithMultipleVertices, TreeComponentStrategy = treeComponentStrategy, }; var chains = new TwoStageChainDecomposition <TNode>(mapDescription, new BreadthFirstChainDecomposition <TNode>(configuration)) .GetChains(mapDescription.GetGraph()).ToList(); return(new ChainDecompositionMutation <TConfiguration, TNode>(priority, chains, maxTreeSize, mergeSmallChains, startTreeWithMultipleVertices, treeComponentStrategy)); }
public new GraphBasedGeneratorConfiguration <TNode> SmartClone() { return(new GraphBasedGeneratorConfiguration <TNode>() { RoomsCanTouch = RoomsCanTouch, EarlyStopIfIterationsExceeded = EarlyStopIfIterationsExceeded, EarlyStopIfTimeExceeded = EarlyStopIfTimeExceeded, RepeatModeOverride = RoomTemplateRepeatMode.NoImmediate, ThrowIfRepeatModeNotSatisfied = ThrowIfRepeatModeNotSatisfied, ChainDecompositionConfiguration = ChainDecompositionConfiguration.SmartClone(), Chains = Chains?.Select(x => new Chain <TNode>(x.Nodes.ToList(), x.Number)).ToList(), SimulatedAnnealingConfiguration = SimulatedAnnealingConfiguration.SmartClone(), SimulatedAnnealingMaxBranching = SimulatedAnnealingMaxBranching, OptimizeCorridorConstraints = OptimizeCorridorConstraints, }); }
public override int GetHashCode() { unchecked { var hashCode = RoomsCanTouch.GetHashCode(); hashCode = (hashCode * 397) ^ EarlyStopIfIterationsExceeded.GetHashCode(); hashCode = (hashCode * 397) ^ EarlyStopIfTimeExceeded.GetHashCode(); hashCode = (hashCode * 397) ^ RepeatModeOverride.GetHashCode(); hashCode = (hashCode * 397) ^ ThrowIfRepeatModeNotSatisfied.GetHashCode(); hashCode = (hashCode * 397) ^ (ChainDecompositionConfiguration != null ? ChainDecompositionConfiguration.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (SimulatedAnnealingConfiguration != null ? SimulatedAnnealingConfiguration.GetHashCode() : 0); hashCode = (hashCode * 397) ^ SimulatedAnnealingMaxBranching; return(hashCode); } }
public DungeonGeneratorConfiguration() { ChainDecompositionConfiguration = new ChainDecompositionConfiguration(); SimulatedAnnealingConfiguration = new SimulatedAnnealingConfigurationProvider(LayoutEvolvers.SimulatedAnnealing.SimulatedAnnealingConfiguration.GetDefaultConfiguration()); }