本文整理汇总了C#中Solver.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Solver.Initialize方法的具体用法?C# Solver.Initialize怎么用?C# Solver.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solver
的用法示例。
在下文中一共展示了Solver.Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HotStreakUtilization_Click
private void HotStreakUtilization_Click(object sender, RoutedEventArgs e)
{
string armor = "Molten Armor";
CalculationOptionsMage calculationOptions = Character.CalculationOptions as CalculationOptionsMage;
CalculationsMage calculations = (CalculationsMage)Calculations.Instance;
Solver solver = new Solver(Character, calculationOptions, false, false, false, 0, armor, false, false, true, false, true, false, false);
solver.Initialize(null);
CastingState baseState = new CastingState(solver, 0, false, 0);
FireCycleGenerator generator = new FireCycleGenerator(baseState);
GenericCycle c1 = new GenericCycle("test", baseState, generator.StateList, true);
Cycle c2 = baseState.GetCycle(CycleId.FBLBPyro);
Dictionary<string, SpellContribution> dict1 = new Dictionary<string, SpellContribution>();
Dictionary<string, SpellContribution> dict2 = new Dictionary<string, SpellContribution>();
c1.AddDamageContribution(dict1, 1.0f, 0);
c2.AddDamageContribution(dict2, 1.0f, 0);
float predicted = dict2["Pyroblast"].Hits / dict2["Fireball"].Hits;
float actual = dict1["Pyroblast"].Hits / dict1["Fireball"].Hits;
StringBuilder sb = new StringBuilder();
sb.AppendLine("Pyro/Nuke Ratio:");
sb.AppendLine();
sb.AppendLine("Approximation Model: " + predicted);
sb.AppendLine("Exact Model: " + actual);
sb.AppendLine();
// predicted = raw * (1 - wastedold)
// actual = raw * (1 - wasted)
// wasted = 1 - actual / predicted * (1 - wastedold)
sb.AppendLine("Predicted Wasted Hot Streaks: " + (1 - actual / predicted));
MessageBox.Show(sb.ToString());
}
示例2: CycleGeneratorComboBox_SelectionChanged
private void CycleGeneratorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string armor;
Solver solver;
CalculationOptionsMage calculationOptions = character.CalculationOptions as CalculationOptionsMage;
CalculationsMage calculations = (CalculationsMage)Calculations.Instance;
switch ((string)((ComboBoxItem)CycleGeneratorComboBox.SelectedItem).Content)
{
case "Arcane":
default:
armor = "Mage Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new ArcaneCycleGeneratorBeta(castingState, true, false, false, false);
break;
case "Arcane Dragonwrath":
armor = "Mage Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new ArcaneCycleGeneratorLegendary(castingState, true, false, false, false);
break;
case "Arcane Hyper Regen":
armor = "Mage Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new ArcaneCycleGeneratorBeta(castingState, true, false, false, true);
break;
case "Arcane AOE":
armor = "Mage Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new ArcaneAOECycleGenerator(castingState, true, false, false);
break;
case "Frost":
armor = "Molten Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new FrostCycleGeneratorBeta(castingState, false, 0.0f, false, 0.0f);
break;
case "Frost+Deep Freeze":
armor = "Molten Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new FrostCycleGeneratorBeta(castingState, true, 30.0f, false, 0.0f);
break;
case "Frost+Freeze":
armor = "Molten Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new FrostCycleGeneratorBeta(castingState, false, 0.0f, true, 25.0f);
break;
case "Frost+Freeze+Deep Freeze":
armor = "Molten Armor";
solver = new Solver(character, calculationOptions, false, false, false, 0, armor, false, false, false, false, true, false, false);
solver.Initialize(null);
castingState = new CastingState(solver, 0, false, 0);
generator = new FrostCycleGeneratorBeta(castingState, true, 30.0f, true, 25.0f);
break;
}
if (castingState == null || generator == null)
{
return;
}
if (character.Ranged != null)
{
wand = new WandTemplate(solver, (MagicSchool)character.Ranged.Item.DamageType, character.Ranged.Item.MinDamage, character.Ranged.Item.MaxDamage, character.Ranged.Item.Speed).GetSpell(castingState);
}
StringBuilder sb = new StringBuilder();
sb.AppendLine(generator.StateDescription);
sb.AppendLine();
for (int i = 0; i < generator.ControlOptions.Length; i++)
{
sb.Append(i);
sb.Append(": ");
sb.Append(generator.StateList[Array.IndexOf(generator.ControlIndex, i)]);
sb.Append(": ");
List<int> keys = new List<int>();
foreach (var kvp in generator.SpellMap[i])
{
keys.Add(generator.SpellList.IndexOf(kvp.Key));
}
keys.Sort();
foreach (var key in keys)
{
sb.Append(key);
sb.Append("=");
sb.Append(generator.SpellList[key]);
//.........这里部分代码省略.........