brewersfan1976

delivery.rb

May 30th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.47 KB | None | 0 0
  1. def delivery(order, shoppers)
  2.     output = Array.new
  3.     x = 0
  4.    
  5.     while (x < shoppers.length)
  6.           fulfill_order_time = (shoppers[x][0] + order[0]) / shoppers[x][1].to_f + shoppers[x][2]
  7.          
  8.           if fulfill_order_time >= order[1] and order[1] + order[2] >= fulfill_order_time then
  9.              output[x] = true
  10.           else
  11.              output[x] = false
  12.           end
  13.              
  14.           x = x + 1
  15.     end
  16.        
  17.     return output
  18. end
Add Comment
Please, Sign In to add comment