Пример #1
0
        public int ScoreRide(Car car, int currentStep)
        {
            int score = 0;
            int rideStart;
            int carArrives = SelfDriving.GetDist(car.Location, StartLocation) + currentStep;

            if (carArrives <= EarliestStart)
            {
                score     = bonus;
                rideStart = EarliestStart;
            }
            else
            {
                rideStart = carArrives;
            }


            int       downTime      = rideStart - currentStep;
            const int MAX_DOWN_TIME = 1000000000;

            score += (MAX_DOWN_TIME - downTime); //invert, so lower downtime gives higher score

            int rideFinish = rideStart + Raw_score;

            if (rideFinish <= LatestFinish && rideFinish <= totalSteps)
            {
                return(score);
                //return downTime;
            }
            else
            {
                return(0);
            }
        }
Пример #2
0
        public void TakeRide(Ride ride, int currentStep)
        {
            int carArrives = SelfDriving.GetDist(Location, ride.StartLocation) + currentStep;
            int rideStart  = (carArrives <= ride.EarliestStart)? ride.EarliestStart: rideStart = carArrives;

            _activeTill = rideStart + ride.Raw_score;
            _location   = ride.EndLocation;
        }
Пример #3
0
 public Ride(List <int> rideDeets, int ind)
 {
     Index         = ind;
     StartLocation = new Tuple <int, int>(rideDeets[0], rideDeets[1]);
     EndLocation   = new Tuple <int, int>(rideDeets[2], rideDeets[3]);
     EarliestStart = rideDeets[4];
     LatestFinish  = rideDeets[5];
     Raw_score     = SelfDriving.GetDist(StartLocation, EndLocation);
 }