add: NeuralSolver

This commit is contained in:
h z
2025-01-23 21:58:27 +00:00
parent f428c6f3a5
commit 98606b4938
7 changed files with 399 additions and 6 deletions

View File

@@ -4,6 +4,7 @@ namespace InverseOfLife;
public class Board
{
[SetsRequiredMembers]
public Board(int w, int h, bool qx = false, bool qy = false, bool useTracer = false)
{
@@ -127,8 +128,26 @@ public class Board
return builder.ToString();
}
public HashSet<(int, int)>[] Frames(int steps)
{
HashSet<(int, int)>[] res = new HashSet<(int, int)>[steps];
for (int i = 0; i < steps; i++)
{
Evaluate();
res[i] = CopyLives();
}
return res;
}
private HashSet<(int, int)> CopyLives()
{
HashSet<(int, int)> res = new();
foreach ((int, int) cell in Lives)
res.Add(cell);
return res;
}
public void Play(int generations, int delay = 200)
{
for (int i = 0; i < generations; i++)