public static void Main() { // first task Potato potato = new Potato(); potato.IsPeeled = true; if (potato != null) { if (potato.IsPeeled && !potato.IsRed) { Cook(potato); } } // second task int x = 3; int y = 5; bool isCellVisited = false; bool isInRangeX = MinX <= x && x <= MaxX; bool isInRangeY = MinY <= y && y <= MaxY; if (isInRangeX && isInRangeY && !isCellVisited) { VisitCell(); } }
private static void Cook(Potato potato) { Console.WriteLine("{0} is cooked.", potato.GetType().Name); }