Ejemplo n.º 1
0
 public void RestoreAngle()
 {
     if (_savedPositions.Count > 0)
     {
         _curPos = _savedPositions.Pop();
     }
 }
Ejemplo n.º 2
0
        public TurtlePosition Forward(double len = 5.0)
        {
            var    angleRad = Math.PI * (_curPos.Angle / 180.0);
            double x        = _curPos.Point.X + Math.Cos(angleRad) * len;
            double y        = _curPos.Point.Y + Math.Sin(angleRad) * len;

            _curPos = new TurtlePosition(new Point(x, y), _curPos.Angle);
            return(_curPos);
        }
Ejemplo n.º 3
0
 public void Turn(double angle)
 {
     _curPos = new TurtlePosition(_curPos.Point, _curPos.Angle + angle);
 }
Ejemplo n.º 4
0
 public Turtle(Point startPoint, double currentAngle = 0.0)
 {
     StartPoint = startPoint;
     _curPos    = new TurtlePosition(startPoint, currentAngle);
 }