public List<LowLevelCommand> Translate(Report current, MovementTo action) { var report = current as StrategyTesterReport; if (report == null) throw new ArgumentException(); var result = new List<LowLevelCommand>(); var targetAngle = AngleCaculator.CalculateAngle(report.Coords, action.Coords); if (Math.Abs(targetAngle - report.AngleInRadians) > 0.0001) result.Add(MakeRotate(report.AngleInRadians, targetAngle)); result.Add(MakeForward(report.Coords, action.Coords)); return result; }
public Strategy MoveTo(int x, int y) { var newItem = new MovementTo(new PointD(x, y)); Connect(newItem); return this; }