Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public kierowca przeprowadz (kierowca[] kierowcy, samochod[] samochody)
- {
- Radom r = new Random ();
- int x;
- int ilsamo;
- for(kierowca k : kierowcy){
- x = r.nextInt(ilsamo);
- k.Setsamochod (samochod[x]);
- samochod[x] = samochod[--ilsamo];
- }
- double best_time = (Double.MAX_VALUE);
- double c_time = 0;
- kierowca best_kierowca = null;
- for(kierowca k : kierowcy){
- for(odcinek o: this.trasa){
- c_time = c_time + k.czas_na_odcinku(o);
- }
- if(c_time < best_time){
- best_time = k.getczas_jechania;
- best_kierowca = k;
- }
- }
- return best_kierowca;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement