Compare commits

..

No commits in common. "1d5c39b9e5424f29eb9690dd0ff1d2001a31a324" and "4a28775e9cfee6575e4e4802ea4e0118347b843f" have entirely different histories.

18 changed files with 161 additions and 843 deletions

File diff suppressed because it is too large Load Diff

View File

@ -86,7 +86,6 @@ public class Test {
System.out.println("\ntest"); System.out.println("\ntest");
SumResult.sum(Database.Plastic, 4); SumResult.sum(Database.Plastic, 4);
*/ */
/*
Item a = Database.HeavyOilResidue; Item a = Database.HeavyOilResidue;
Item b = Database.Water; Item b = Database.Water;
Map<Item, Recipe> preferences = Database.preferences; Map<Item, Recipe> preferences = Database.preferences;
@ -134,10 +133,6 @@ public class Test {
planFor("screw", new Production(Database.ReinforcedIronPlate, 1)); planFor("screw", new Production(Database.ReinforcedIronPlate, 1));
planFor("rotor", new Production(Database.Rotor, 1)); planFor("rotor", new Production(Database.Rotor, 1));
planFor("mf", new Production(Database.ModularFrame, 10)); planFor("mf", new Production(Database.ModularFrame, 10));
*/
//planFor("aluminumIngot", new Production(Database.AluminumIngot, 240));
//planFor("fusedFrame", new Production(Database.FusedModularFrame, 1.5));
planFor("p4", new Production(Database.AssemblyDirectorSystem,4), new Production(Database.MagneticFieldGenerator, 4), new Production(Database.ThermalPropulsionRocket, 1), new Production(Database.NuclearPasta, 1));
} }
private static void planFor(Item item, int amount, String name) { private static void planFor(Item item, int amount, String name) {

View File

@ -25,7 +25,7 @@ public abstract class Building {
public Map<Item, Integer> getCost(int n) { public Map<Item, Integer> getCost(int n) {
Map<Item, Integer> instances = new HashMap<>(); Map<Item, Integer> instances = new HashMap<>();
getCost().forEach((item, integer) -> instances.put(item, n * integer)); cost.forEach((item, integer) -> instances.put(item, n * integer));
return instances; return instances;
} }

View File

@ -1,12 +0,0 @@
package satisfactory.buildings;
import satisfactory.items.Item;
import java.util.Map;
public class DecorationBuilding extends Building {
public DecorationBuilding(String name, Map<Item, Integer> cost){
super(name);
this.cost = cost;
}
}

View File

@ -1,16 +0,0 @@
package satisfactory.buildings;
import satisfactory.items.Item;
import java.util.Map;
public class ParticleAccelerator extends ProductionBuilding{
public ParticleAccelerator(String name, int power, Map<Item, Integer> cost) {
super(name, power, cost);
}
@Override
public Integer getPower() {
return 1000; // TODO calculate
}
}

View File

@ -1,22 +0,0 @@
package satisfactory.buildings;
import satisfactory.Database;
import satisfactory.items.Item;
import java.util.HashMap;
import java.util.Map;
public class ResourceWellExtractor extends ProductionBuilding{
private final Building dependendBuilding;
public ResourceWellExtractor(String name, Map<Item, Integer> cost,Building pressurizer) {
super(name, 0, cost);
dependendBuilding = pressurizer;
}
@Override
public Map<Item, Integer> getCost() {
Map<Item, Integer> totalCost = new HashMap<>(super.getCost());
dependendBuilding.getCost().forEach((item, integer) -> totalCost.merge(item, integer, Integer::sum));
return totalCost;
}
}

View File

@ -13,22 +13,21 @@ import java.util.Set;
public abstract class Item { public abstract class Item {
private final String name; private final String name;
private final Set<Recipe> recipes; private final Set<Recipe> recipes;
public final int stackSize;
public int sum = 0; public int sum = 0;
protected boolean isRaw = false; protected boolean isRaw = false;
private Recipe preference = null; private Recipe preference = null;
protected Item(String name, int stackSize, Set<Recipe> recipes) { protected Item(String name, Set<Recipe> recipes) {
this.name = name; this.name = name;
this.stackSize = stackSize;
this.recipes = recipes; this.recipes = recipes;
Database.add(this);
for (Recipe recipe : recipes) { for (Recipe recipe : recipes) {
add(recipe); add(recipe);
} }
} }
public Item(String name, int stackSize) { public Item(String name) {
this(name, stackSize, new HashSet<>()); this(name, new HashSet<>());
} }
public static Map<Item, Double> production(Graph<Item, DefaultWeightedEdge> graph) { public static Map<Item, Double> production(Graph<Item, DefaultWeightedEdge> graph) {
@ -96,11 +95,7 @@ public abstract class Item {
} }
public String ID() { public String ID() {
return getName() return getName().replace(" ", "").replace(".", "_");
.replace(" ", "")
.replace(".", "_")
.replace("-", "")
;
} }
public Recipe getPreference() { public Recipe getPreference() {

View File

@ -62,8 +62,8 @@ public class RecipeBuilder {
this.byProducts.add(byProduct); this.byProducts.add(byProduct);
return this; return this;
} }
public RecipeBuilder setByProducts(Set<Item> byProducts) { public RecipeBuilder setByProducts(Set<Item> byProduct) {
this.byProducts = byProducts;// TODO: merge? this.byProducts =byProducts;// TODO: merge?
return this; return this;
} }

View File

@ -5,6 +5,6 @@ import satisfactory.items.Item;
public abstract class Fluid extends Item { public abstract class Fluid extends Item {
public Fluid(String name) { public Fluid(String name) {
super(name, 0); super(name);
} }
} }

View File

@ -2,7 +2,7 @@ package satisfactory.items.type;
import satisfactory.items.Item; import satisfactory.items.Item;
public class Gas extends Fluid { public class Gas extends Item {
public Gas(String name) { public Gas(String name) {
super(name); super(name);

View File

@ -4,7 +4,7 @@ import satisfactory.items.Item;
public class Ingot extends Item { public class Ingot extends Item {
public Ingot(String name, int stackSize) { public Ingot(String name) {
super(name, stackSize); super(name);
} }
} }

View File

@ -4,8 +4,8 @@ import satisfactory.items.Item;
public class Ore extends Item { public class Ore extends Item {
public Ore(String name, int stackSize) { public Ore(String name) {
super(name, stackSize); super(name);
setIsRaw(); setIsRaw();
} }

View File

@ -4,7 +4,7 @@ import satisfactory.items.Item;
public class Part extends Item { public class Part extends Item {
public Part(String name, int stackSize) { public Part(String name) {
super(name, stackSize); super(name);
} }
} }

View File

@ -4,8 +4,8 @@ import satisfactory.items.Item;
public class Pickup extends Item { public class Pickup extends Item {
public Pickup(String name, int stackSize) { public Pickup(String name) {
super(name, stackSize); super(name);
setIsRaw(); setIsRaw();
} }
} }

View File

@ -4,7 +4,7 @@ import satisfactory.items.Item;
public class Tool extends Item { public class Tool extends Item {
public Tool(String name, int stackSize) { public Tool(String name) {
super(name, stackSize); super(name);
} }
} }

View File

@ -62,14 +62,8 @@ class ItemTest {
} }
@Test @Test
void productionRubberAndPlastic( void productionRubberAndPlastic() {
) {
test("rubberAndPlastic", Database.Rubber, Database.Plastic); test("rubberAndPlastic", Database.Rubber, Database.Plastic);
} }
@Test
void productionAluminumIngot() {
test("aluminumIngot", Database.AluminumIngot);
}
} }

View File

@ -1,17 +0,0 @@
package satisfactory.items;
import org.junit.jupiter.api.Test;
import satisfactory.Database;
import static org.junit.jupiter.api.Assertions.fail;
import static satisfactory.items.TestHelper.test;
class Phase4Test {
@Test
void testPhase4() {
test("phase4", Database.AssemblyDirectorSystem, Database.MagneticFieldGenerator);
fail("Missing items!");
//test("phase4", Database.AssemblyDirectorSystem, Database.MagneticFieldGenerator, Database.ThermalPropulsionRocket, Database.NuclearPasta);
}
}

View File

@ -94,19 +94,6 @@ public class ValidatedValues {
ref.put(item, 1.); ref.put(item, 1.);
values.put(item, ref); values.put(item, ref);
} }
{
Item item = Database.AluminumIngot;
Map<Item, Double> ref = new HashMap<>();
ref.put(Database.AluminumScrap, 1.5);
ref.put(Database.Water, 1.5);
ref.put(Database.RawQuartz, 0.5);
ref.put(Database.Silica, 1.25);
ref.put(Database.AluminaSolution, 1.0);
ref.put(Database.Bauxite, 0.5);
ref.put(Database.Coal, 0.5);
ref.put(item, 1.0);
values.put(item, ref);
}
} }
public static Map<Item, Double> get(Item item) { public static Map<Item, Double> get(Item item) {