public static List <Ride> Build(string[] lines)
        {
            var rides = new List <Ride>(lines.Length);

            for (var i = 0; i < lines.Length; i++)
            {
                var line = lines[i];
                var pars = line.Split(' ');
                var a    = int.Parse(pars[0]);
                var b    = int.Parse(pars[1]);
                var x    = int.Parse(pars[2]);
                var y    = int.Parse(pars[3]);
                var s    = int.Parse(pars[4]);
                var f    = int.Parse(pars[5]);
                var ride = new Ride(i, new Point(a, b), new Point(x, y), s, f);
                rides.Add(ride);
            }

            return(rides);
        }
示例#2
0
        public static int GetFactScore(Ride ride, Car car, int bonus)
        {
            if (car.Equals(Car.SkipRide))
            {
                return(0);
            }

            var score        = 0;
            var rideDistance = ride.From.Distance(ride.To);
            var pickDistance = car.Location.Distance(ride.From);

            score += rideDistance;
            var timeToPick = car.Time + pickDistance;
            var onTime     = timeToPick <= ride.Start;

            if (onTime)
            {
                score += bonus;
            }
            return(score);
        }
示例#3
0
 protected bool Equals(MakeRideAction other)
 {
     return(Ride.Equals(other.Ride) && Car.Equals(other.Car));
 }
示例#4
0
 public MakeRideAction(Ride ride, Car car)
 {
     Ride = ride;
     Car  = car;
 }
 public bool CanMakeIt(Ride ride)
 {
     return(ride.Finish >= Time + Location.Distance(ride.From) + ride.From.Distance(ride.To));
 }