public List <Cella> KornyezoUresCellak(Allat allat)
        {
            var c = Megkeres(allat);

            if (c is null)
            {
                return(null);
            }

            var cellak = new List <Cella>();

            for (int x = Math.Max(0, c.X - 1);
                 x <= Math.Min(c.X + 1, Terulet.GetLength(0) - 1);
                 x++)
            {
                for (int y = Math.Max(0, c.Y - 1);
                     y <= Math.Min(c.Y + 1, Terulet.GetLength(1) - 1);
                     y++)
                {
                    if (!(x == c.X && y == c.Y) && Terulet[x, y] == null)
                    {
                        cellak.Add(new Cella(x, y));
                    }
                }
            }
            return(cellak);
        }
        public List <Allat> KornyezoAllatok(Allat allat, bool nov)
        {
            var c = Megkeres(allat);

            if (c is null)
            {
                return(null);
            }

            var allatok = new List <Allat>();

            for (int x = Math.Max(0, c.X - 1);
                 x <= Math.Min(c.X + 1, Terulet.GetLength(0) - 1);
                 x++)
            {
                for (int y = Math.Max(0, c.Y - 1);
                     y <= Math.Min(c.Y + 1, Terulet.GetLength(1) - 1);
                     y++)
                {
                    if (!(x == c.X && y == c.Y) && Terulet[x, y] != null)
                    {
                        if (nov && Terulet[x, y] is Novenyevo)
                        {
                            allatok.Add(Terulet[x, y]);
                        }
                        if (!nov && Terulet[x, y] is Ragadozo)
                        {
                            allatok.Add(Terulet[x, y]);
                        }
                    }
                }
            }
            return(allatok);
        }
        private void Torol(Allat allat)
        {
            var c = Megkeres(allat);

            if (c != null)
            {
                Terulet[c.X, c.Y] = null;
            }
        }
 public Cella Megkeres(Allat allat)
 {
     for (int x = 0; x < Terulet.GetLength(0); x++)
     {
         for (int y = 0; y < Terulet.GetLength(1); y++)
         {
             if (Terulet[x, y] == allat)
             {
                 return(new Cella(x, y));
             }
         }
     }
     return(null);
 }
 public void Mozgat(Allat allat, Cella c)
 {
     Torol(allat);
     Elhelyez(allat, c);
 }
 public void Elhelyez(Allat allat, Cella c)
 {
     Terulet[c.X, c.Y] = allat;
 }