Remove crafty namespace from solver

This commit is contained in:
Asriel Camora
2023-10-02 12:16:43 -07:00
parent cfb5c53f3b
commit e6081f5e60
15 changed files with 24 additions and 24 deletions
+34
View File
@@ -0,0 +1,34 @@
using System.Runtime.CompilerServices;
namespace Craftimizer.Solver;
public sealed class ArenaNode<T> where T : struct
{
public T State;
public ArenaBuffer<T> Children;
public NodeScoresBuffer ChildScores;
public (int arrayIdx, int subIdx) ChildIdx;
public readonly ArenaNode<T>? Parent;
public NodeScoresBuffer? ParentScores => Parent?.ChildScores;
public ArenaNode(T state, ArenaNode<T>? parent = null)
{
State = state;
Children = new();
ChildScores = new();
Parent = parent;
}
public ArenaNode<T>? ChildAt((int arrayIdx, int subIdx) at) =>
Children.Data?[at.arrayIdx]?[at.subIdx];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ArenaNode<T> Add(T state)
{
var node = new ArenaNode<T>(state, this);
ChildScores.Add();
Children.Add(node);
return node;
}
}