Big changes 2

- Split into several projects
- All dalamud/lumina deps are in the plugin
- Crafty/craftingway sim implemented!
- optimizations to follow
This commit is contained in:
Asriel Camora
2023-06-17 08:50:46 -07:00
parent 15d416ef2a
commit e190368d62
76 changed files with 1284 additions and 435 deletions
+29
View File
@@ -0,0 +1,29 @@
namespace Craftimizer.Solver.Crafty;
public class Arena<T> where T : struct
{
public readonly record struct Node
{
public int? Parent { get; init; }
public int Index { get; init; }
public List<int> Children { get; init; }
public T State { get; init; }
}
public List<Node> Nodes { get; } = new();
public Arena(T initialState = default)
{
Nodes.Add(new() { Parent = null, Index = 0, Children = new(), State = initialState });
}
public int Insert(int parentIndex, T state)
{
var index = Nodes.Count;
Nodes.Add(new() { Parent = parentIndex, Index = index, Children = new(), State = state });
Nodes[parentIndex].Children.Add(index);
return index;
}
public Node Get(int index) => Nodes[index];
}