Пример #1
0
        public int GetNeighbors(Cell c)
        {
            int nl = 0;

            for (int x = -1; x <= 1; x++)
            {
                for (int y = -1; y <= 1; y++)
                {
                    if (c.Equals(new Cell(c.X + x, c.Y + y)) == false)
                    {
                        if (isCell(c.X + x, c.Y + y))
                        {
                            nl++;
                        }
                    }
                }
            }

            return(nl);
        }
Пример #2
0
 public bool EqualsReturnsTrueWhenCoordinatesAreEqual(LifeStates lifeA, int aX, int aY, LifeStates lifeB, int bX, int bY)
 {
     Cell cellA = new Cell(lifeA, aX, aY);
     Cell block4 = new Cell(lifeB, bX, bY);
     return cellA.Equals(block4);
 }