Exemplo n.º 1
0
        public void Frequencies()
        {
            var freqs = CellMaths.Frequencies(new List <Cell> {
                new Cell(1, 1), new Cell(1, 1)
            });

            CollectionAssert.AreEquivalent(new Dictionary <Cell, int>
            {
                { new Cell(1, 1), 2 }
            }, freqs);
        }
Exemplo n.º 2
0
        public void CoordinateFinder()
        {
            var neighbours = CellMaths.NeighboursOf(new Cell(1, 1));

            Assert.Contains(new Cell(0, 0), neighbours);
            Assert.Contains(new Cell(0, 1), neighbours);
            Assert.Contains(new Cell(0, 2), neighbours);

            Assert.Contains(new Cell(1, 0), neighbours);
            Assert.Contains(new Cell(1, 2), neighbours);

            Assert.Contains(new Cell(2, 0), neighbours);
            Assert.Contains(new Cell(2, 1), neighbours);
            Assert.Contains(new Cell(2, 2), neighbours);
        }
Exemplo n.º 3
0
 private Dictionary <Cell, int> FindHowOftenANeighbourIsReferenced(HashSet <Cell> world)
 {
     return(CellMaths.Frequencies(CellMaths.AllNeighbours(world)));
 }