public static Bot <TCommand> CreateSquareWalkingBot <TCommand>(this ISimpleMovementRules <TCommand> factory, int distance) where TCommand : ISimpleMovementCommand, new() { return(new Bot <TCommand>(turn => turn % 2 == 0 ? factory.Move(distance) : factory.Rotate(Angle.HalfPi) )); }
public static Bot <TCommand> CreateRandomWalkingBot <TCommand>(this ISimpleMovementRules <TCommand> factory, int distance) where TCommand : ISimpleMovementCommand, new() { var random = new Random(); return(new Bot <TCommand>(turn => turn % 2 == 0 ? factory.Move(distance) : factory.Rotate(Angle.FromGrad(random.NextDouble() * 360)) )); }