Exemple #1
0
        public void NeighborsWithColorTest()
        {
            Assert.AreEqual(0, Mutator.neighborsWithColorHV(1, new int[] { 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 1, 1, 3, 3, false));
            Assert.AreEqual(4, Mutator.neighborsWithColorHV(1, new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 1, 1, 3, 3, false));
            Assert.AreEqual(1, Mutator.neighborsWithColorHV(1, new int[] { 1, 1, 0, 0, 1, 0, 0, 0, 0 }, 1, 1, 3, 3, false));
            Assert.AreEqual(1, Mutator.neighborsWithColorHV(1, new int[] { 1, 1, 0, 0, 1, 0, 0, 0, 0 }, 0, 0, 3, 3, false));

            Assert.AreEqual(0, new Arr <int>(new int[] { 0, 0, 0, 0, 1, 0, 0, 0, 0 }, 3, 3).NeighborsWithValueHV(1, 1, 1, 1, false));
            Assert.AreEqual(4, new Arr <int>(new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1 }, 3, 3).NeighborsWithValueHV(1, 1, 1, 1, false));
            Assert.AreEqual(1, new Arr <int>(new int[] { 1, 1, 0, 0, 1, 0, 0, 0, 0 }, 3, 3).NeighborsWithValueHV(1, 1, 1, 1, false));
            Assert.AreEqual(1, new Arr <int>(new int[] { 1, 1, 0, 0, 1, 0, 0, 0, 0 }, 3, 3).NeighborsWithValueHV(0, 0, 1, 1, false));
        }