예제 #1
0
 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)
                               ));
 }
예제 #2
0
        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))
                                      ));
        }