Exemplo n.º 1
0
    static void Main(string[] args)
    {
      // The old way, slithering, is still quite possible.
      // Just create and install a Slithering movement object.
      Slithering slither = new Slithering();
      Robosnake slitheringSnake = new Robosnake(slither);
      slitheringSnake.Move(3, 3);

      // So does the new way, undulating.
      // Just create and install an Undulating movement object
      // instead of a Slithering movement object.
      Undulating undulate = new Undulating();
      Robosnake undulatingSnake = new Robosnake(undulate);
      undulatingSnake.Move(3, 3);

      // Wait for user to acknowledge results.
      Console.WriteLine("Press Enter to terminate...");
      Console.Read();
    }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // The old way, slithering, is still quite possible.
            // Just create and install a Slithering movement object.
            Slithering slither         = new Slithering();
            Robosnake  slitheringSnake = new Robosnake(slither);

            slitheringSnake.Move(3, 3);

            // So does the new way, undulating.
            // Just create and install an Undulating movement object
            // instead of a Slithering movement object.
            Undulating undulate        = new Undulating();
            Robosnake  undulatingSnake = new Robosnake(undulate);

            undulatingSnake.Move(3, 3);

            // Wait for user to acknowledge results.
            Console.WriteLine("Press Enter to terminate...");
            Console.Read();
        }