public static void Main()
        {
            /*  Potato potato;
                //...
                if (potato != null)
                   if(!potato.HasNotBeenPeeled && !potato.IsRotten)
                    Cook(potato);
             */
            var potato = new Potato();

            if (potato != null)
            {
                Potato.Peel(potato);

                if (potato.IsPeeled && !potato.IsRotten)
                {
                    Cook(potato);
                }
            }

            /*
             * if (x >= MIN_X && (x =< MAX_X && ((MAX_Y >= y && MIN_Y <= y) && !shouldNotVisitCell)))
                {
                   VisitCell();
                }
            */
            int positionX = 5;
            int positionY = 5;
            if (IsInRange(positionX, positionY) && CellIsNotVisited(positionX, positionY))
            {
                VisitCell();
            }
        }
示例#2
0
        public void Cook()
        {
            Potato potato = new Potato();
            Carrot carrot = new Carrot();
            Bowl bowl = new Bowl();

            Potato.Peel(potato);
            Carrot.Peel(carrot);

            this.Cut(potato);
            this.Cut(carrot);

            bowl.Add(carrot);
            bowl.Add(potato);
        }