private static void EatInPassingFn(Creature c) { try { if (c.CanEat > 0) { int plantid = BaseAI.getPlantAtLocation(c.X + 1, c.Y); if (-1 != plantid && BaseAI.plants[plantid].Size > 0) { c.eat(c.X + 1, c.Y); } else { plantid = BaseAI.getPlantAtLocation(c.X - 1, c.Y); if (-1 != plantid && BaseAI.plants[plantid].Size > 0) { c.eat(c.X - 1, c.Y); } else { plantid = BaseAI.getPlantAtLocation(c.X, c.Y + 1); if (-1 != plantid && BaseAI.plants[plantid].Size > 0) { c.eat(c.X, c.Y + 1); } else { plantid = BaseAI.getPlantAtLocation(c.X, c.Y - 1); if (-1 != plantid && BaseAI.plants[plantid].Size > 0) { c.eat(c.X, c.Y - 1); } } } } } } catch { Console.WriteLine("error in EatInPassingFn"); } // BreedInPassing(c); }