From: brabuhr@... Date: 2010-08-19T03:12:52+09:00 Subject: Re: can i do this in ruby? a simulation process On Wed, Aug 18, 2010 at 1:57 PM, Bruce Wayner wrote: > can someone edit my code: > i've been trying to change the thing you said but it shows nothing. :( > print "Number of Vehicle: " #That will be maximum of 5 only > n = gets().to_i START DELETE > print "\n Vehicle number 1: " >  $delay1 = rand(4) >  $delay2 = rand(10) >  $departure_Time = rand(36) >  $travel_Time= rand(71) > >  $delay1 +=1 >  sleep($delay1) >  sleep($delay2) >  $passenger2= 1 >  $delay101 = rand(10) >  puts ("\nDeparture Time:  #$departure_Time seconds"); >  puts ("Traveling Time:  #$travel_Time seconds"); >  puts ("# of passenger Arrive in Second City: #{$passenger2}"); >  puts ("Total Traveling Time:     #{$delay1} seconds"); >  $i = 1+1; END DELETE Add: $i = 1 >  $num = n+1; > >  while $i < $num  do > >  puts ("\n Vehicle number: #{$i}"); >  $i +=1; > >  $departure_time2 = rand(36) >  $travel_time2 = rand(71) >  $passenger1=2 >     puts ("\nDeparture Time:  #$departure_time2 seconds"); >     puts ("Traveling Time:  #$travel_time2 seconds"); >    puts ("# of people Arrive in second city: #{$passenger1}"); >    puts ("Total Traveling Time:  #$totalTravel"); > >  end >  puts("# of people transfer:"); >  puts("Total Time:"); That's a start to cut down the amount of code you have to deal with and still give pretty much the same result.