Ejemplo n.º 1
0
    private string SolveB()
    {
        var eris  = new MultiEris();
        var lines = File.ReadAllLines(Input, Encoding.UTF8);

        for (var y = 0; y < 5; y++)
        {
            for (var x = 0; x < 5; x++)
            {
                if (lines[y][x] == '#')
                {
                    var index = new MultiEris.Index {
                        X = x, Y = y, Depth = 0
                    };
                    eris.SetContent(index, true);
                }
            }
        }

        var next = eris;

        for (int i = 0; i < 200; i++)
        {
            next = next.Iterate();
        }
        return(next.BugCount.ToString());
    }
Ejemplo n.º 2
0
 public bool Equals(MultiEris.Index other)
 {
     return(other != null &&
            other.Depth == Depth &&
            other.X == X &&
            other.Y == Y);
 }
Ejemplo n.º 3
0
    public bool ProveB()
    {
        var index1 = new MultiEris.Index {
            Depth = 0, X = 3, Y = 3
        };
        var neighbors1 = MultiEris.Neighbors(index1);

        if (neighbors1.Length != 4)
        {
            return(false);
        }
        var index2 = new MultiEris.Index {
            Depth = 1, X = 3, Y = 0
        };
        var neighbors2 = MultiEris.Neighbors(index2);

        if (neighbors2.Length != 4)
        {
            return(false);
        }
        var index3 = new MultiEris.Index {
            Depth = 1, X = 4, Y = 0
        };
        var neighbors3 = MultiEris.Neighbors(index3);

        if (neighbors3.Length != 4)
        {
            return(false);
        }
        var index4 = new MultiEris.Index {
            Depth = 1, X = 3, Y = 2
        };
        var neighbors4 = MultiEris.Neighbors(index4);

        if (neighbors4.Length != 8)
        {
            return(false);
        }

        var eris  = new MultiEris();
        var lines = File.ReadAllLines(Example, Encoding.UTF8);

        for (var y = 0; y < 5; y++)
        {
            for (var x = 0; x < 5; x++)
            {
                if (lines[y][x] == '#')
                {
                    var index = new MultiEris.Index {
                        X = x, Y = y, Depth = 0
                    };
                    eris.SetContent(index, true);
                }
            }
        }

        if (eris.BugCount != 8)
        {
            return(false);
        }

        // Iterate 10 times
        var next = eris;

        for (int i = 0; i < 10; i++)
        {
            next = next.Iterate();
        }
        if (next.BugCount != 99)
        {
            return(false);
        }

        return(true);
    }