static void Main() { Potato potato = new Potato(); if (potato != null) { bool notPeeled = !potato.IsPeeled; bool notRotten = !potato.IsRotten; if (notPeeled && notRotten) { potato.Cook(); } } const int MinX = 5; const int MaxX = 15; const int MinY = 5; const int MaxY = 15; int x = 7; int y = 8; bool shouldVisitCell = true; if (shouldVisitCell && IsInRange(x, MinX, MaxX) && IsInRange(y, MinY, MaxY)) { VisitCell(); } }
public static void Main() { Potato potato = new Potato(); if (potato != null) { if (potato.IsPeeled && !potato.IsRotten) { potato.Cook(); } } }
static void Main() { const int MinX = 5; const int MaxX = 15; const int MinY = 5; const int MaxY = 15; Potato potato = new Potato(); //Task 2.1 /* * Potato potato; * //... * if (potato != null) * if(!potato.HasNotBeenPeeled && !potato.IsRotten) * Cook(potato); */ if (potato != null) { bool notPeerled = !potato.IsPeeled; bool notRotten = !potato.IsRotten; if (notPeerled && notRotten) { potato.Cook(); } } int x = 7; int y = 8; bool shouldVisitCell = true; //Task 2.2 /* * if (x >= MIN_X && (x =< MAX_X && ((MAX_Y >= y && MIN_Y <= y) && !shouldNotVisitCell))) * { * VisitCell(); * } */ if (shouldVisitCell && IsInRange(x, MinX, MaxX) && IsInRange(y, MinY, MaxY)) { VisitCell(); } }
static void Main() { const int MinX = 5; const int MaxX = 15; const int MinY = 5; const int MaxY = 15; Potato potato = new Potato(); //Task 2.1 /* Potato potato; //... if (potato != null) if(!potato.HasNotBeenPeeled && !potato.IsRotten) Cook(potato); */ if (potato != null) { bool notPeerled = !potato.IsPeeled; bool notRotten = !potato.IsRotten; if (notPeerled && notRotten) { potato.Cook(); } } int x = 7; int y = 8; bool shouldVisitCell = true; //Task 2.2 /* if (x >= MIN_X && (x =< MAX_X && ((MAX_Y >= y && MIN_Y <= y) && !shouldNotVisitCell))) { VisitCell(); } */ if (shouldVisitCell && IsInRange(x, MinX, MaxX) && IsInRange(y, MinY, MaxY)) { VisitCell(); } }
static void Main(string[] args) { Potato potato = new Potato(); // some code if (potato != null && potato.IsPeeled && potato.IsRotten) { potato.Cook(); } // some more code bool shouldVisitCell = true; int cellX = 50; int cellY = 50; if (shouldVisitCell && (cellX >= MinX && cellX <= MaxX) && (cellY >= MinY && cellY <= MaxY)) { VisitCell(cellY, cellX); } }