Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public kierowca przeprowadz (kierowca[] kierowcy, samochod[] samochody)
  2. {
  3. Radom r = new Random ();
  4. int x;
  5. int ilsamo;
  6. for(kierowca k : kierowcy){
  7. x = r.nextInt(ilsamo);
  8. k.Setsamochod (samochod[x]);
  9. samochod[x] = samochod[--ilsamo];
  10. }
  11. double best_time = (Double.MAX_VALUE);
  12. double c_time = 0;
  13. kierowca best_kierowca = null;
  14. for(kierowca k : kierowcy){
  15. for(odcinek o: this.trasa){
  16. c_time = c_time + k.czas_na_odcinku(o);
  17. }
  18. if(c_time < best_time){
  19. best_time = k.getczas_jechania;
  20. best_kierowca = k;
  21. }
  22.  
  23. }
  24. return best_kierowca;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement