add: NeuralSolver
This commit is contained in:
23
src/Board.cs
23
src/Board.cs
@@ -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++)
|
||||
|
||||
Reference in New Issue
Block a user