public void SilverAndCobalt2() { var cobalt = new Blueprint("CobaltOreToIngot", 1, new ItemAndQuantity("Ore/Cobalt", 0.25), new ItemAndQuantity("Ingot/Cobalt", 0.075)); var silver = new Blueprint("SilverOreToIngot", 1, new ItemAndQuantity("Ore/Silver", 1), new ItemAndQuantity("Ingot/Silver", 0.1)); var stockpiles = new IngotStockpiles(new[] { new IngotStockpile(new IngotType("Ingot/Cobalt", 220) { ProductionNormalisationFactor = 0.075 }), new IngotStockpile(new IngotType("Ingot/Silver", 10) { ProductionNormalisationFactor = 0.1 }) }); var ingotWorklist = new IngotWorklist(stockpiles); stockpiles.UpdateAssemblerSpeed(10); stockpiles.UpdateQuantities(new TestIngotQuantities { { "Ingot/Cobalt", 220 }, { "Ingot/Silver", 10 } }); ingotWorklist.Initialise(); var cobaltScore = ingotWorklist.ScoreBlueprint(cobalt); var silverScore = ingotWorklist.ScoreBlueprint(silver); Assert.That(silverScore, Is.EqualTo(cobaltScore).Within(0.01).Percent); }
public void HighYieldBlueprintScoresHigherThanLowYieldBlueprint() { var blueprintALow = new Blueprint("ALow", 1, new ItemAndQuantity("Ore/A", 10), new ItemAndQuantity("Ingot/A", 10)); var blueprintAHigh = new Blueprint("AHigh", 1, new ItemAndQuantity("Ore/A", 10), new ItemAndQuantity("Ingot/A", 12)); var stockpiles = new IngotStockpiles(new TestIngotDefinitions { { "Ingot/A", 100 } }); var ingotWorklist = new IngotWorklist(stockpiles); stockpiles.UpdateQuantities(new TestIngotQuantities { { "Ingot/A", 50 } }); ingotWorklist.Initialise(); var aLowScore = ingotWorklist.ScoreBlueprint(blueprintALow); var aHighScore = ingotWorklist.ScoreBlueprint(blueprintAHigh); Assert.That(aHighScore, Is.GreaterThan(aLowScore)); }
public void ZeroStockpileDoesNotCauseAllYieldingBlueprintsToBeScoredEqually() { var blueprintALow = new Blueprint("ALow", 1, new ItemAndQuantity("Ore/A", 10), new ItemAndQuantity("Ingot/A", 10)); var blueprintAHigh = new Blueprint("AHigh", 1, new ItemAndQuantity("Ore/A", 10), new ItemAndQuantity("Ingot/A", 12)); var stockpiles = new IngotStockpiles(new TestIngotDefinitions { { "Ingot/A", 100 } }); var ingotWorklist = new IngotWorklist(stockpiles); stockpiles.UpdateQuantities(new TestIngotQuantities { { "Ingot/A", 0 } }); ingotWorklist.Initialise(); var aLowScore = ingotWorklist.ScoreBlueprint(blueprintALow); var aHighScore = ingotWorklist.ScoreBlueprint(blueprintAHigh); Assert.That(aHighScore, Is.GreaterThan(aLowScore)); }
public void BlueprintWithAllOutputsInDemandScoresHigherThanBlueprintWithOnlyOneOutputInDemand() { var blueprintAB = new Blueprint("AB", 1, new ItemAndQuantity("Ore/AB", 10), new ItemAndQuantity("Ingot/A", 10), new ItemAndQuantity("Ingot/B", 10)); var blueprintBC = new Blueprint("BC", 1, new ItemAndQuantity("Ore/BC", 10), new ItemAndQuantity("Ingot/B", 10), new ItemAndQuantity("Ingot/C", 10)); var stockpiles = new IngotStockpiles(new TestIngotDefinitions { { "Ingot/A", 100 }, { "Ingot/B", 100 }, { "Ingot/C", 100 } }); var ingotWorklist = new IngotWorklist(stockpiles); stockpiles.UpdateQuantities(new TestIngotQuantities { { "Ingot/A", 500 }, // Not in demand. { "Ingot/B", 50 }, { "Ingot/C", 50 } }); ingotWorklist.Initialise(); var abScore = ingotWorklist.ScoreBlueprint(blueprintAB); var bcScore = ingotWorklist.ScoreBlueprint(blueprintBC); Assert.That(bcScore, Is.GreaterThan(abScore)); }
public void ToleratesBlueprintsWithUnknownIngotTypes() { var blueprint = new Blueprint("A", 1, new ItemAndQuantity("Ore/A", 10), new ItemAndQuantity("Ingot/A", 10)); var stockpiles = new IngotStockpiles(new TestIngotDefinitions { { "Ingot/B", 100 } }); var ingotWorklist = new IngotWorklist(stockpiles); var refinery = Refinery.Get(mockRefinery, new RefineryType("Refinery") { SupportedBlueprints = { "A" } }, 1); stockpiles.UpdateQuantities(new TestIngotQuantities { { "Ingot/B", 20 } }); ingotWorklist.Initialise(); ingotWorklist.ScoreBlueprint(blueprint); ingotWorklist.UpdateStockpileEstimates(refinery, blueprint, 5); }