public static void Main()
Console.WriteLine("Hello World");
public void Forward(int x1, int y1, int x2, int y2)
g.DrawLine(p, x1, y1, x2, y2);
public abstract class Command
public int[] ParamsInt = new int[100];
public Command(Turtle turtle)
public virtual void Set(Turtle turtle, params int[] list)
public abstract Turtle Execute();
public class ForwardCommand : Command
public ForwardCommand(Turtle turtle) : base(turtle)
public void Set(Turtle turtle, params int[] list)
public override Turtle Execute()
_turtle.forward(ParamsInt[0]);
public class CommandFactory
public Command getCommand(String command)
command = command.ToUpper().Trim();
if (command.Equals("FORWARD"))
return new ForwardCommand();
MessageBox.Show("Command does not exist");
public void programParser(String line)
if (command.Equals("forward"))
ForwardCommand c = (ForwardCommand)cf.getCommand("forward");
c.Set(turtle, ParamsInt[0]);