Tue May 20 21:22:26 2025 digital_dice_test(): python version: 3.10.12 numpy version: 1.26.4 Test digital_dice(). aandb(): In game A, you flip a biased coin, which shows heads with probabiity] 1/2 - epsilon you win a dollar on heads. In game B, you have two biased coins. If, at the time just before you decide to flip, your capital M is a multiple of 3 dollars, you chose coin 1, which shows heads with probability 1/10 - epsilon, otherwise you choose coin 2, which shows heads with probability 3/4 - epsilon. Both games A and B are losing games for you. But, paradoxically, if you randomly switch back and forth between one game and the other, you end up winning over the long term. Use graphics to display the winnings. Graphics saved as "aandb.png" average(): Use a Monte Carlo sample to estimate pi. Estimate for pi = 3.1336648720253555 Error = 0.00792778156443763 Antithetic estimate for pi = 3.098228534843065 Error = 0.043364118746727964 average(): Use a Monte Carlo sample to estimate pi. Estimate for pi = 3.132189205629684 Error = 0.009403447960109279 Antithetic estimate for pi = 3.1414788830929354 Error = 0.00011377049685767915 average(): Use a Monte Carlo sample to estimate pi. Estimate for pi = 3.1414937425450478 Error = 9.89110447453534e-05 Antithetic estimate for pi = 3.1418822145769725 Error = -0.0002895609871793603 baby_boom(): There are given probabilities of a man having 0, 1, 2, 3, 4, 5, 6 or 7 sons. What are the chances of having: 2 sons in the second generation? 4 sons in the second generation? 6 sons in the third generation? Estimated probabilities: 2 males in generation 2 = 0.0676 4 males in generation 2 = 0.0355 6 males in generation 3 = 0.0223 baby_boom(): There are given probabilities of a man having 0, 1, 2, 3, 4, 5, 6 or 7 sons. What are the chances of having: 2 sons in the second generation? 4 sons in the second generation? 6 sons in the third generation? Estimated probabilities: 2 males in generation 2 = 0.06829 4 males in generation 2 = 0.0389 6 males in generation 3 = 0.02118 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.5 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 1.33327 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.5 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 2.00157 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.5 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 4.5748 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.5 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 5.16174 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.5 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 18.65851 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.4 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 1.39178 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.4 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 2.08768 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.4 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 4.7717 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.4 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 5.35459 broke(): Three players begin with L, M and N dollars. On each turn, each player flips a coin. All coins have the same bias P = 0.4 If one player is "odd man out", he pays a dollar to each other player. When a player is bankrupt, the game is over. What is the average number of turns required? Average number of turns = 19.40694 bus(): A bus stop is serviced by 1 bus linesp. In any hour, each bus line will come to the stop at a random time. A passenger arrives at the bus stop at a random time. What is the average wait for a bus? Estimated waiting time = 0.49983291565789323 Theoretical time = 0.5 bus(): A bus stop is serviced by 2 bus linesp. In any hour, each bus line will come to the stop at a random time. A passenger arrives at the bus stop at a random time. What is the average wait for a bus? Estimated waiting time = 0.33367143906445096 Theoretical time = 0.3333333333333333 bus(): A bus stop is serviced by 3 bus linesp. In any hour, each bus line will come to the stop at a random time. A passenger arrives at the bus stop at a random time. What is the average wait for a bus? Estimated waiting time = 0.24975263528709982 Theoretical time = 0.25 bus(): A bus stop is serviced by 4 bus linesp. In any hour, each bus line will come to the stop at a random time. A passenger arrives at the bus stop at a random time. What is the average wait for a bus? Estimated waiting time = 0.2003401613830918 Theoretical time = 0.2 bus(): A bus stop is serviced by 5 bus linesp. In any hour, each bus line will come to the stop at a random time. A passenger arrives at the bus stop at a random time. What is the average wait for a bus? Estimated waiting time = 0.1667134565465949 Theoretical time = 0.16666666666666666 car(): Park 3 cars in a line, and compute each car's nearest neighbor Estimate the probability that a given car is the nearest neighbor of its nearest neighbor. Estimated probability = 0.6666666666666666 Theoretical probability = 0.6666666666666666 car(): Park 10 cars in a line, and compute each car's nearest neighbor Estimate the probability that a given car is the nearest neighbor of its nearest neighbor. Estimated probability = 0.666622 Theoretical probability = 0.6666666666666666 car(): Park 20 cars in a line, and compute each car's nearest neighbor Estimate the probability that a given car is the nearest neighbor of its nearest neighbor. Estimated probability = 0.6667774000000001 Theoretical probability = 0.6666666666666666 car(): Park 30 cars in a line, and compute each car's nearest neighbor Estimate the probability that a given car is the nearest neighbor of its nearest neighbor. Estimated probability = 0.6664546 Theoretical probability = 0.6666666666666666 chess(): A has to play three games of chess against B and C. A beats B with probability P, C with probability Q A has a choice of schedules: BCB or CBC. To win the tournament, A must win two successive games. Which schedule is better? Estimated win probability for BCB is = 0.792011 Estimated win probability for CBC is = 0.863981 chess(): A has to play three games of chess against B and C. A beats B with probability P, C with probability Q A has a choice of schedules: BCB or CBC. To win the tournament, A must win two successive games. Which schedule is better? Estimated win probability for BCB is = 0.397033 Estimated win probability for CBC is = 0.57661 chess(): A has to play three games of chess against B and C. A beats B with probability P, C with probability Q A has a choice of schedules: BCB or CBC. To win the tournament, A must win two successive games. Which schedule is better? Estimated win probability for BCB is = 0.192197 Estimated win probability for CBC is = 0.204681 chess(): A has to play three games of chess against B and C. A beats B with probability P, C with probability Q A has a choice of schedules: BCB or CBC. To win the tournament, A must win two successive games. Which schedule is better? Estimated win probability for BCB is = 0.0637 Estimated win probability for CBC is = 0.075711 committee(): From a faculty of 6 professors, 6 associate professors, 10 assistant professors, and 12 instructors, a committee of size 6 is formed randomly. What is the probablity that there is at least one person of each rank in the committee? Estimated probability = 0.38024 Theoretical probablity = 0.3790307709695264 deli(): A deli is open for 36,000 seconds. There are 1 or 2 clerks. Customers arrive at random. The amount of time it takes to service a customer is random. Customers are served in order. A clerk serves one customer at a time. Newly arrived customers wait in a queue if no clerk is available. What is the average and maximal times spent per customer? What is the average and maximal queue length? What percentage of time are the clerks idle? clock = 76 queue_length = 1 clock = 105 queue_length = 2 clock = 160 queue_length = 3 clock = 166 queue_length = 4 clock = 235 queue_length = 5 clock = 384 queue_length = 6 clock = 704 queue_length = 1 clock = 727 queue_length = 1 clock = 1032 queue_length = 1 clock = 1038 queue_length = 2 clock = 1111 queue_length = 3 clock = 1220 queue_length = 3 clock = 1258 queue_length = 4 clock = 1444 queue_length = 4 clock = 1603 queue_length = 2 clock = 1726 queue_length = 1 clock = 1741 queue_length = 2 clock = 1824 queue_length = 3 clock = 1872 queue_length = 4 clock = 1995 queue_length = 4 clock = 2215 queue_length = 4 clock = 2315 queue_length = 4 clock = 2328 queue_length = 5 clock = 2409 queue_length = 5 clock = 2537 queue_length = 4 clock = 2632 queue_length = 4 clock = 2821 queue_length = 2 clock = 2873 queue_length = 3 clock = 2956 queue_length = 4 clock = 3325 queue_length = 2 clock = 3327 queue_length = 3 clock = 3350 queue_length = 4 clock = 3354 queue_length = 4 clock = 3368 queue_length = 5 clock = 3374 queue_length = 6 clock = 3387 queue_length = 7 clock = 3465 queue_length = 8 clock = 3523 queue_length = 6 clock = 3699 queue_length = 6 clock = 3829 queue_length = 6 clock = 4134 queue_length = 3 clock = 4715 queue_length = 1 clock = 4759 queue_length = 2 clock = 4766 queue_length = 2 clock = 5030 queue_length = 1 clock = 5372 queue_length = 1 clock = 5510 queue_length = 1 clock = 5526 queue_length = 2 clock = 5592 queue_length = 2 clock = 5700 queue_length = 2 clock = 5713 queue_length = 3 clock = 5783 queue_length = 4 clock = 6205 queue_length = 1 clock = 6469 queue_length = 1 clock = 6940 queue_length = 1 clock = 7170 queue_length = 1 clock = 7277 queue_length = 1 clock = 7769 queue_length = 1 clock = 7893 queue_length = 1 clock = 7996 queue_length = 1 clock = 8088 queue_length = 2 clock = 8162 queue_length = 3 clock = 8231 queue_length = 4 clock = 8244 queue_length = 4 clock = 8261 queue_length = 4 clock = 8313 queue_length = 4 clock = 8373 queue_length = 2 clock = 8694 queue_length = 1 clock = 8720 queue_length = 2 clock = 9012 queue_length = 1 clock = 9094 queue_length = 2 clock = 9109 queue_length = 3 clock = 9317 queue_length = 3 clock = 9329 queue_length = 4 clock = 9446 queue_length = 4 clock = 9694 queue_length = 3 clock = 9755 queue_length = 3 clock = 9897 queue_length = 3 clock = 10053 queue_length = 3 clock = 10124 queue_length = 4 clock = 10359 queue_length = 3 clock = 10630 queue_length = 1 clock = 11052 queue_length = 1 clock = 11076 queue_length = 2 clock = 11122 queue_length = 2 clock = 11168 queue_length = 2 clock = 11271 queue_length = 3 clock = 11292 queue_length = 4 clock = 11330 queue_length = 5 clock = 11335 queue_length = 6 clock = 11368 queue_length = 7 clock = 11454 queue_length = 8 clock = 11498 queue_length = 9 clock = 11640 queue_length = 9 clock = 11822 queue_length = 9 clock = 12210 queue_length = 7 clock = 12212 queue_length = 8 clock = 12462 queue_length = 8 clock = 12794 queue_length = 2 clock = 13165 queue_length = 1 clock = 13362 queue_length = 1 clock = 13414 queue_length = 2 clock = 13459 queue_length = 3 clock = 13678 queue_length = 1 clock = 13691 queue_length = 2 clock = 13835 queue_length = 2 clock = 13854 queue_length = 3 clock = 13965 queue_length = 1 clock = 13980 queue_length = 2 clock = 14518 queue_length = 1 clock = 14572 queue_length = 2 clock = 14575 queue_length = 3 clock = 14672 queue_length = 4 clock = 14673 queue_length = 5 clock = 14708 queue_length = 5 clock = 14750 queue_length = 6 clock = 14831 queue_length = 7 clock = 15067 queue_length = 4 clock = 15100 queue_length = 5 clock = 15130 queue_length = 4 clock = 15152 queue_length = 5 clock = 15163 queue_length = 6 clock = 15392 queue_length = 5 clock = 15761 queue_length = 4 clock = 15854 queue_length = 3 clock = 15962 queue_length = 3 clock = 16019 queue_length = 3 clock = 16098 queue_length = 3 clock = 16445 queue_length = 1 clock = 16746 queue_length = 1 clock = 16867 queue_length = 1 clock = 16889 queue_length = 2 clock = 16934 queue_length = 3 clock = 17029 queue_length = 3 clock = 17107 queue_length = 4 clock = 17375 queue_length = 2 clock = 17469 queue_length = 1 clock = 18049 queue_length = 1 clock = 18102 queue_length = 1 clock = 18139 queue_length = 1 clock = 18173 queue_length = 1 clock = 18552 queue_length = 1 clock = 18680 queue_length = 2 clock = 18682 queue_length = 3 clock = 18707 queue_length = 4 clock = 19134 queue_length = 1 clock = 19139 queue_length = 1 clock = 19723 queue_length = 1 clock = 19782 queue_length = 1 clock = 19900 queue_length = 1 clock = 19952 queue_length = 1 clock = 19955 queue_length = 2 clock = 20034 queue_length = 3 clock = 20108 queue_length = 4 clock = 20335 queue_length = 4 clock = 20465 queue_length = 5 clock = 20485 queue_length = 6 clock = 20488 queue_length = 7 clock = 20803 queue_length = 4 clock = 20904 queue_length = 2 clock = 21224 queue_length = 1 clock = 21360 queue_length = 1 clock = 21381 queue_length = 2 clock = 21695 queue_length = 1 clock = 22355 queue_length = 1 clock = 22421 queue_length = 1 clock = 22435 queue_length = 2 clock = 22563 queue_length = 1 clock = 22580 queue_length = 2 clock = 22698 queue_length = 2 clock = 22730 queue_length = 3 clock = 22833 queue_length = 3 clock = 23458 queue_length = 1 clock = 23632 queue_length = 2 clock = 23689 queue_length = 3 clock = 23745 queue_length = 3 clock = 23849 queue_length = 3 clock = 24040 queue_length = 2 clock = 24839 queue_length = 1 clock = 24988 queue_length = 1 clock = 25254 queue_length = 1 clock = 25333 queue_length = 2 clock = 25572 queue_length = 1 clock = 26258 queue_length = 1 clock = 27296 queue_length = 1 clock = 27326 queue_length = 2 clock = 27343 queue_length = 3 clock = 27522 queue_length = 1 clock = 27539 queue_length = 2 clock = 27641 queue_length = 2 clock = 27759 queue_length = 2 clock = 27868 queue_length = 3 clock = 28177 queue_length = 1 clock = 28277 queue_length = 2 clock = 28394 queue_length = 2 clock = 28457 queue_length = 2 clock = 28485 queue_length = 3 clock = 28487 queue_length = 4 clock = 28511 queue_length = 4 clock = 28622 queue_length = 4 clock = 28667 queue_length = 5 clock = 28676 queue_length = 5 clock = 28888 queue_length = 4 clock = 29012 queue_length = 1 clock = 29265 queue_length = 1 clock = 29310 queue_length = 1 clock = 29393 queue_length = 1 clock = 29401 queue_length = 2 clock = 29728 queue_length = 1 clock = 29745 queue_length = 2 clock = 29810 queue_length = 3 clock = 29831 queue_length = 4 clock = 29849 queue_length = 5 clock = 29896 queue_length = 6 clock = 29999 queue_length = 4 clock = 30166 queue_length = 4 clock = 31140 queue_length = 1 clock = 31319 queue_length = 1 clock = 32484 queue_length = 1 clock = 33332 queue_length = 1 clock = 33526 queue_length = 1 clock = 33579 queue_length = 1 clock = 33642 queue_length = 1 clock = 33645 queue_length = 2 clock = 33796 queue_length = 1 clock = 34159 queue_length = 1 clock = 34248 queue_length = 2 clock = 34257 queue_length = 3 clock = 34283 queue_length = 3 clock = 34308 queue_length = 4 clock = 34378 queue_length = 3 clock = 34431 queue_length = 3 clock = 34947 queue_length = 1 clock = 35957 queue_length = 1 clock = 35994 queue_length = 2 Average total time at deli 273.1132686084142 Maximum time at deli 1185.0 Average queue length 1.5754444444444444 Maximum queue length 9 Percent idle time clerk1 22.788888888888888 Percent idle time clerk2 0.0 deli(): A deli is open for 36,000 seconds. There are 1 or 2 clerks. Customers arrive at random. The amount of time it takes to service a customer is random. Customers are served in order. A clerk serves one customer at a time. Newly arrived customers wait in a queue if no clerk is available. What is the average and maximal times spent per customer? What is the average and maximal queue length? What percentage of time are the clerks idle? clock = 2415 queue_length = 1 clock = 2563 queue_length = 2 clock = 2667 queue_length = 2 clock = 2693 queue_length = 3 clock = 2739 queue_length = 4 clock = 6219 queue_length = 1 clock = 6250 queue_length = 2 clock = 6347 queue_length = 1 clock = 8182 queue_length = 1 clock = 8232 queue_length = 1 clock = 9938 queue_length = 1 clock = 10751 queue_length = 1 clock = 10784 queue_length = 1 clock = 12539 queue_length = 1 clock = 13101 queue_length = 1 clock = 13167 queue_length = 2 clock = 13765 queue_length = 1 clock = 13774 queue_length = 2 clock = 13786 queue_length = 2 clock = 13855 queue_length = 1 clock = 14519 queue_length = 1 clock = 14805 queue_length = 1 clock = 15128 queue_length = 1 clock = 15362 queue_length = 1 clock = 16320 queue_length = 1 clock = 17407 queue_length = 1 clock = 17466 queue_length = 2 clock = 17511 queue_length = 2 clock = 17557 queue_length = 3 clock = 17967 queue_length = 1 clock = 18925 queue_length = 1 clock = 18992 queue_length = 1 clock = 19000 queue_length = 2 clock = 20176 queue_length = 1 clock = 20322 queue_length = 1 clock = 23035 queue_length = 1 clock = 23095 queue_length = 1 clock = 23398 queue_length = 1 clock = 23419 queue_length = 1 clock = 23500 queue_length = 2 clock = 25017 queue_length = 1 clock = 25047 queue_length = 2 clock = 25077 queue_length = 1 clock = 25102 queue_length = 1 clock = 26041 queue_length = 1 clock = 26320 queue_length = 1 clock = 26327 queue_length = 2 clock = 26663 queue_length = 1 clock = 26677 queue_length = 1 clock = 26847 queue_length = 1 clock = 26990 queue_length = 1 clock = 27060 queue_length = 1 clock = 28371 queue_length = 1 clock = 28386 queue_length = 1 clock = 28444 queue_length = 1 clock = 28492 queue_length = 1 clock = 31592 queue_length = 1 clock = 31655 queue_length = 1 clock = 32003 queue_length = 1 clock = 32746 queue_length = 1 clock = 32923 queue_length = 1 clock = 34141 queue_length = 1 clock = 34302 queue_length = 1 clock = 34479 queue_length = 1 Average total time at deli 98.4478527607362 Maximum time at deli 477.0 Average queue length 0.08425 Maximum queue length 4 Percent idle time clerk1 50.102777777777774 Percent idle time clerk2 68.44166666666666 deli(): A deli is open for 36,000 seconds. There are 1 or 2 clerks. Customers arrive at random. The amount of time it takes to service a customer is random. Customers are served in order. A clerk serves one customer at a time. Newly arrived customers wait in a queue if no clerk is available. What is the average and maximal times spent per customer? What is the average and maximal queue length? What percentage of time are the clerks idle? clock = 182 queue_length = 1 clock = 288 queue_length = 1 clock = 294 queue_length = 2 clock = 586 queue_length = 1 clock = 855 queue_length = 2 clock = 901 queue_length = 3 clock = 946 queue_length = 4 clock = 960 queue_length = 5 clock = 967 queue_length = 6 clock = 1021 queue_length = 7 clock = 1024 queue_length = 8 clock = 1110 queue_length = 7 clock = 1178 queue_length = 8 clock = 1204 queue_length = 9 clock = 1367 queue_length = 10 clock = 1398 queue_length = 9 clock = 1463 queue_length = 9 clock = 1537 queue_length = 10 clock = 1544 queue_length = 10 clock = 1606 queue_length = 11 clock = 1616 queue_length = 12 clock = 1630 queue_length = 13 clock = 1690 queue_length = 13 clock = 1719 queue_length = 14 clock = 1721 queue_length = 15 clock = 1798 queue_length = 16 clock = 2002 queue_length = 15 clock = 2041 queue_length = 16 clock = 2137 queue_length = 17 clock = 2153 queue_length = 18 clock = 2188 queue_length = 19 clock = 2212 queue_length = 20 clock = 2253 queue_length = 21 clock = 2278 queue_length = 22 clock = 2309 queue_length = 22 clock = 2373 queue_length = 21 clock = 2405 queue_length = 22 clock = 2484 queue_length = 22 clock = 2565 queue_length = 23 clock = 2687 queue_length = 24 clock = 2853 queue_length = 22 clock = 2931 queue_length = 22 clock = 2991 queue_length = 23 clock = 2992 queue_length = 24 clock = 2999 queue_length = 24 clock = 3010 queue_length = 25 clock = 3025 queue_length = 26 clock = 3035 queue_length = 27 clock = 3098 queue_length = 28 clock = 3106 queue_length = 29 clock = 3114 queue_length = 30 clock = 3215 queue_length = 30 clock = 3280 queue_length = 29 clock = 3326 queue_length = 30 clock = 3337 queue_length = 31 clock = 3364 queue_length = 32 clock = 3439 queue_length = 33 clock = 3449 queue_length = 34 clock = 3465 queue_length = 35 clock = 3634 queue_length = 36 clock = 3655 queue_length = 37 clock = 3689 queue_length = 36 clock = 3768 queue_length = 37 clock = 3802 queue_length = 37 clock = 3804 queue_length = 38 clock = 3874 queue_length = 38 clock = 3890 queue_length = 39 clock = 3955 queue_length = 40 clock = 4041 queue_length = 41 clock = 4068 queue_length = 42 clock = 4076 queue_length = 43 clock = 4155 queue_length = 43 clock = 4212 queue_length = 44 clock = 4241 queue_length = 45 clock = 4253 queue_length = 46 clock = 4442 queue_length = 44 clock = 4538 queue_length = 45 clock = 4568 queue_length = 46 clock = 4591 queue_length = 47 clock = 4617 queue_length = 48 clock = 4952 queue_length = 45 clock = 5033 queue_length = 44 clock = 5110 queue_length = 45 clock = 5323 queue_length = 44 clock = 5356 queue_length = 45 clock = 5557 queue_length = 46 clock = 5610 queue_length = 46 clock = 5690 queue_length = 47 clock = 5718 queue_length = 47 clock = 5771 queue_length = 47 clock = 5845 queue_length = 47 clock = 5921 queue_length = 48 clock = 6043 queue_length = 49 clock = 6162 queue_length = 50 clock = 6475 queue_length = 50 clock = 6515 queue_length = 51 clock = 6536 queue_length = 52 clock = 6550 queue_length = 52 clock = 6563 queue_length = 53 clock = 6621 queue_length = 54 clock = 6634 queue_length = 55 clock = 6667 queue_length = 56 clock = 6735 queue_length = 57 clock = 6784 queue_length = 58 clock = 6797 queue_length = 59 clock = 6838 queue_length = 60 clock = 6953 queue_length = 61 clock = 7032 queue_length = 62 clock = 7059 queue_length = 63 clock = 7100 queue_length = 64 clock = 7204 queue_length = 64 clock = 7232 queue_length = 65 clock = 7241 queue_length = 66 clock = 7409 queue_length = 65 clock = 7635 queue_length = 66 clock = 7670 queue_length = 67 clock = 7689 queue_length = 68 clock = 7764 queue_length = 69 clock = 7773 queue_length = 70 clock = 7810 queue_length = 70 clock = 7848 queue_length = 71 clock = 7854 queue_length = 72 clock = 7935 queue_length = 72 clock = 8145 queue_length = 70 clock = 8152 queue_length = 71 clock = 8240 queue_length = 70 clock = 8460 queue_length = 70 clock = 8585 queue_length = 71 clock = 8635 queue_length = 71 clock = 8742 queue_length = 71 clock = 8821 queue_length = 71 clock = 8842 queue_length = 72 clock = 8930 queue_length = 72 clock = 8981 queue_length = 73 clock = 9058 queue_length = 74 clock = 9113 queue_length = 74 clock = 9132 queue_length = 75 clock = 9244 queue_length = 74 clock = 9291 queue_length = 75 clock = 9297 queue_length = 76 clock = 9307 queue_length = 77 clock = 9395 queue_length = 77 clock = 9417 queue_length = 78 clock = 9504 queue_length = 79 clock = 9531 queue_length = 80 clock = 9558 queue_length = 80 clock = 9563 queue_length = 81 clock = 9578 queue_length = 82 clock = 9604 queue_length = 83 clock = 9608 queue_length = 84 clock = 9701 queue_length = 83 clock = 9724 queue_length = 84 clock = 9772 queue_length = 85 clock = 9776 queue_length = 86 clock = 9815 queue_length = 85 clock = 10153 queue_length = 86 clock = 10231 queue_length = 87 clock = 10308 queue_length = 88 clock = 10616 queue_length = 88 clock = 10625 queue_length = 89 clock = 10627 queue_length = 90 clock = 10748 queue_length = 91 clock = 10754 queue_length = 92 clock = 10813 queue_length = 93 clock = 10845 queue_length = 94 clock = 10934 queue_length = 95 clock = 11148 queue_length = 94 clock = 11194 queue_length = 95 clock = 11214 queue_length = 96 clock = 11286 queue_length = 97 clock = 11334 queue_length = 97 clock = 11357 queue_length = 98 clock = 11458 queue_length = 99 clock = 11549 queue_length = 100 clock = 11600 queue_length = 101 clock = 11638 queue_length = 102 clock = 11837 queue_length = 101 clock = 11840 queue_length = 102 clock = 11982 queue_length = 102 clock = 12001 queue_length = 103 clock = 12082 queue_length = 104 clock = 12117 queue_length = 105 clock = 12306 queue_length = 106 clock = 12386 queue_length = 107 clock = 12414 queue_length = 108 clock = 12417 queue_length = 109 clock = 12616 queue_length = 109 clock = 12619 queue_length = 110 clock = 12688 queue_length = 111 clock = 12807 queue_length = 111 clock = 12853 queue_length = 112 clock = 12965 queue_length = 111 clock = 12978 queue_length = 112 clock = 12983 queue_length = 113 clock = 12984 queue_length = 114 clock = 13067 queue_length = 113 clock = 13069 queue_length = 114 clock = 13087 queue_length = 115 clock = 13151 queue_length = 116 clock = 13215 queue_length = 117 clock = 13343 queue_length = 117 clock = 13354 queue_length = 118 clock = 13359 queue_length = 119 clock = 13400 queue_length = 120 clock = 13428 queue_length = 121 clock = 13760 queue_length = 119 clock = 13792 queue_length = 120 clock = 13849 queue_length = 120 clock = 13889 queue_length = 121 clock = 14119 queue_length = 122 clock = 14192 queue_length = 123 clock = 14310 queue_length = 124 clock = 14363 queue_length = 125 clock = 14383 queue_length = 126 clock = 14387 queue_length = 127 clock = 14540 queue_length = 126 clock = 14700 queue_length = 127 clock = 14709 queue_length = 128 clock = 14794 queue_length = 126 clock = 14837 queue_length = 126 clock = 14867 queue_length = 126 clock = 14892 queue_length = 127 clock = 14963 queue_length = 128 clock = 15098 queue_length = 129 clock = 15112 queue_length = 130 clock = 15157 queue_length = 131 clock = 15198 queue_length = 132 clock = 15200 queue_length = 133 clock = 15205 queue_length = 134 clock = 15252 queue_length = 135 clock = 15280 queue_length = 136 clock = 15316 queue_length = 135 clock = 15430 queue_length = 136 clock = 15606 queue_length = 136 clock = 15689 queue_length = 136 clock = 15873 queue_length = 135 clock = 15928 queue_length = 136 clock = 15982 queue_length = 136 clock = 16144 queue_length = 137 clock = 16246 queue_length = 136 clock = 16253 queue_length = 137 clock = 16256 queue_length = 138 clock = 16279 queue_length = 139 clock = 16440 queue_length = 140 clock = 16567 queue_length = 141 clock = 16672 queue_length = 141 clock = 16716 queue_length = 141 clock = 16724 queue_length = 142 clock = 16780 queue_length = 142 clock = 16851 queue_length = 143 clock = 16918 queue_length = 142 clock = 16925 queue_length = 143 clock = 16938 queue_length = 144 clock = 16940 queue_length = 145 clock = 16944 queue_length = 146 clock = 17010 queue_length = 147 clock = 17092 queue_length = 147 clock = 17259 queue_length = 146 clock = 17371 queue_length = 146 clock = 17414 queue_length = 147 clock = 17435 queue_length = 148 clock = 17467 queue_length = 149 clock = 17495 queue_length = 150 clock = 17554 queue_length = 151 clock = 17569 queue_length = 152 clock = 17628 queue_length = 153 clock = 17641 queue_length = 154 clock = 17662 queue_length = 155 clock = 17743 queue_length = 155 clock = 17781 queue_length = 156 clock = 17800 queue_length = 157 clock = 17803 queue_length = 158 clock = 17857 queue_length = 157 clock = 18126 queue_length = 157 clock = 18188 queue_length = 158 clock = 18205 queue_length = 159 clock = 18241 queue_length = 159 clock = 18276 queue_length = 159 clock = 18329 queue_length = 160 clock = 18350 queue_length = 161 clock = 18355 queue_length = 162 clock = 18396 queue_length = 163 clock = 18479 queue_length = 162 clock = 18514 queue_length = 163 clock = 18681 queue_length = 162 clock = 18707 queue_length = 163 clock = 19007 queue_length = 162 clock = 19152 queue_length = 162 clock = 19250 queue_length = 163 clock = 19316 queue_length = 164 clock = 19384 queue_length = 165 clock = 19427 queue_length = 166 clock = 19562 queue_length = 166 clock = 19639 queue_length = 167 clock = 19705 queue_length = 168 clock = 19790 queue_length = 169 clock = 19802 queue_length = 170 clock = 19824 queue_length = 171 clock = 19920 queue_length = 172 clock = 19933 queue_length = 173 clock = 19959 queue_length = 174 clock = 20041 queue_length = 175 clock = 20076 queue_length = 174 clock = 20185 queue_length = 175 clock = 20194 queue_length = 176 clock = 20214 queue_length = 177 clock = 20289 queue_length = 177 clock = 20362 queue_length = 178 clock = 20381 queue_length = 178 clock = 20486 queue_length = 176 clock = 20584 queue_length = 175 clock = 20589 queue_length = 176 clock = 20644 queue_length = 176 clock = 20670 queue_length = 176 clock = 20691 queue_length = 177 clock = 20764 queue_length = 177 clock = 20839 queue_length = 178 clock = 20856 queue_length = 179 clock = 20914 queue_length = 180 clock = 21007 queue_length = 181 clock = 21011 queue_length = 182 clock = 21027 queue_length = 183 clock = 21084 queue_length = 184 clock = 21118 queue_length = 185 clock = 21232 queue_length = 184 clock = 21238 queue_length = 185 clock = 21266 queue_length = 186 clock = 21301 queue_length = 187 clock = 21337 queue_length = 188 clock = 21408 queue_length = 189 clock = 21525 queue_length = 187 clock = 21592 queue_length = 186 clock = 21642 queue_length = 187 clock = 21671 queue_length = 188 clock = 21732 queue_length = 189 clock = 21766 queue_length = 190 clock = 21847 queue_length = 191 clock = 21900 queue_length = 191 clock = 21984 queue_length = 192 clock = 22088 queue_length = 192 clock = 22170 queue_length = 192 clock = 22282 queue_length = 191 clock = 22417 queue_length = 191 clock = 22541 queue_length = 190 clock = 22691 queue_length = 191 clock = 22700 queue_length = 192 clock = 22778 queue_length = 193 clock = 22781 queue_length = 194 clock = 22786 queue_length = 195 clock = 22897 queue_length = 196 clock = 23030 queue_length = 197 clock = 23058 queue_length = 198 clock = 23063 queue_length = 199 clock = 23110 queue_length = 200 clock = 23118 queue_length = 201 clock = 23148 queue_length = 200 clock = 23150 queue_length = 201 clock = 23198 queue_length = 202 clock = 23262 queue_length = 203 clock = 23291 queue_length = 203 clock = 23379 queue_length = 203 clock = 23530 queue_length = 203 clock = 23613 queue_length = 202 clock = 23655 queue_length = 203 clock = 23708 queue_length = 204 clock = 23729 queue_length = 205 clock = 23742 queue_length = 206 clock = 23779 queue_length = 206 clock = 23970 queue_length = 207 clock = 23983 queue_length = 208 clock = 24028 queue_length = 208 clock = 24062 queue_length = 209 clock = 24174 queue_length = 209 clock = 24213 queue_length = 210 clock = 24446 queue_length = 210 clock = 24497 queue_length = 211 clock = 24498 queue_length = 212 clock = 24629 queue_length = 209 clock = 24634 queue_length = 210 clock = 24647 queue_length = 209 clock = 24784 queue_length = 209 clock = 24878 queue_length = 210 clock = 24932 queue_length = 211 clock = 24959 queue_length = 212 clock = 24996 queue_length = 213 clock = 25044 queue_length = 214 clock = 25191 queue_length = 215 clock = 25205 queue_length = 215 clock = 25398 queue_length = 213 clock = 25432 queue_length = 214 clock = 25473 queue_length = 215 clock = 25510 queue_length = 216 clock = 25520 queue_length = 217 clock = 25570 queue_length = 218 clock = 25679 queue_length = 219 clock = 25687 queue_length = 220 clock = 25699 queue_length = 221 clock = 25784 queue_length = 222 clock = 25855 queue_length = 223 clock = 25893 queue_length = 223 clock = 25933 queue_length = 224 clock = 26246 queue_length = 218 clock = 26248 queue_length = 219 clock = 26251 queue_length = 220 clock = 26259 queue_length = 221 clock = 26327 queue_length = 221 clock = 26378 queue_length = 222 clock = 26483 queue_length = 221 clock = 26533 queue_length = 222 clock = 26668 queue_length = 222 clock = 26746 queue_length = 222 clock = 26795 queue_length = 222 clock = 26796 queue_length = 223 clock = 26800 queue_length = 224 clock = 26858 queue_length = 225 clock = 26921 queue_length = 226 clock = 26924 queue_length = 227 clock = 26943 queue_length = 228 clock = 26950 queue_length = 229 clock = 27004 queue_length = 230 clock = 27046 queue_length = 229 clock = 27162 queue_length = 230 clock = 27230 queue_length = 231 clock = 27305 queue_length = 231 clock = 27307 queue_length = 232 clock = 27308 queue_length = 233 clock = 27406 queue_length = 233 clock = 27466 queue_length = 234 clock = 27533 queue_length = 234 clock = 27698 queue_length = 234 clock = 27715 queue_length = 235 clock = 27716 queue_length = 236 clock = 27900 queue_length = 235 clock = 27932 queue_length = 234 clock = 27949 queue_length = 235 clock = 27998 queue_length = 236 clock = 28146 queue_length = 237 clock = 28208 queue_length = 238 clock = 28210 queue_length = 239 clock = 28282 queue_length = 240 clock = 28292 queue_length = 241 clock = 28303 queue_length = 242 clock = 28333 queue_length = 242 clock = 28434 queue_length = 243 clock = 28833 queue_length = 244 clock = 29174 queue_length = 244 clock = 29188 queue_length = 245 clock = 29225 queue_length = 246 clock = 29314 queue_length = 245 clock = 29381 queue_length = 245 clock = 29385 queue_length = 246 clock = 29527 queue_length = 247 clock = 29535 queue_length = 248 clock = 29555 queue_length = 249 clock = 29601 queue_length = 250 clock = 29727 queue_length = 249 clock = 29751 queue_length = 250 clock = 29762 queue_length = 250 clock = 29983 queue_length = 251 clock = 30033 queue_length = 251 clock = 30061 queue_length = 252 clock = 30233 queue_length = 253 clock = 30371 queue_length = 252 clock = 30403 queue_length = 253 clock = 30542 queue_length = 253 clock = 30637 queue_length = 253 clock = 30725 queue_length = 253 clock = 30831 queue_length = 254 clock = 30876 queue_length = 255 clock = 30896 queue_length = 256 clock = 30985 queue_length = 257 clock = 31015 queue_length = 258 clock = 31327 queue_length = 257 clock = 31462 queue_length = 258 clock = 31506 queue_length = 257 clock = 31538 queue_length = 258 clock = 31714 queue_length = 257 clock = 31731 queue_length = 257 clock = 31757 queue_length = 258 clock = 31848 queue_length = 259 clock = 31881 queue_length = 260 clock = 31940 queue_length = 258 clock = 31953 queue_length = 259 clock = 32101 queue_length = 256 clock = 32221 queue_length = 255 clock = 32237 queue_length = 256 clock = 32285 queue_length = 257 clock = 32294 queue_length = 258 clock = 32313 queue_length = 259 clock = 32395 queue_length = 260 clock = 32396 queue_length = 261 clock = 32415 queue_length = 262 clock = 32724 queue_length = 261 clock = 32728 queue_length = 262 clock = 32864 queue_length = 262 clock = 32985 queue_length = 262 clock = 33114 queue_length = 263 clock = 33227 queue_length = 263 clock = 33301 queue_length = 264 clock = 33352 queue_length = 265 clock = 33491 queue_length = 266 clock = 33543 queue_length = 266 clock = 33549 queue_length = 267 clock = 33754 queue_length = 268 clock = 33761 queue_length = 269 clock = 33894 queue_length = 270 clock = 33900 queue_length = 271 clock = 33978 queue_length = 272 clock = 34100 queue_length = 272 clock = 34111 queue_length = 273 clock = 34242 queue_length = 273 clock = 34309 queue_length = 274 clock = 34354 queue_length = 274 clock = 34356 queue_length = 275 clock = 34369 queue_length = 276 clock = 34468 queue_length = 276 clock = 34540 queue_length = 276 clock = 34617 queue_length = 275 clock = 34625 queue_length = 276 clock = 34652 queue_length = 277 clock = 34720 queue_length = 278 clock = 34894 queue_length = 277 clock = 34946 queue_length = 278 clock = 34956 queue_length = 279 clock = 34982 queue_length = 280 clock = 35171 queue_length = 278 clock = 35185 queue_length = 279 clock = 35300 queue_length = 279 clock = 35428 queue_length = 280 clock = 35433 queue_length = 281 clock = 35524 queue_length = 282 clock = 35546 queue_length = 282 clock = 35646 queue_length = 281 clock = 35838 queue_length = 281 clock = 35863 queue_length = 282 Average total time at deli 10332.152941176471 Maximum time at deli 19109.0 Average queue length 150.8372222222222 Maximum queue length 282 Percent idle time clerk1 0.29444444444444445 Percent idle time clerk2 0.0 deli(): A deli is open for 36,000 seconds. There are 1 or 2 clerks. Customers arrive at random. The amount of time it takes to service a customer is random. Customers are served in order. A clerk serves one customer at a time. Newly arrived customers wait in a queue if no clerk is available. What is the average and maximal times spent per customer? What is the average and maximal queue length? What percentage of time are the clerks idle? clock = 475 queue_length = 1 clock = 558 queue_length = 1 clock = 607 queue_length = 2 clock = 613 queue_length = 3 clock = 816 queue_length = 1 clock = 1226 queue_length = 1 clock = 1265 queue_length = 2 clock = 1378 queue_length = 3 clock = 1467 queue_length = 3 clock = 1916 queue_length = 1 clock = 1944 queue_length = 1 clock = 1965 queue_length = 2 clock = 2126 queue_length = 2 clock = 2150 queue_length = 3 clock = 2211 queue_length = 4 clock = 2216 queue_length = 5 clock = 2288 queue_length = 6 clock = 2318 queue_length = 7 clock = 2384 queue_length = 8 clock = 2385 queue_length = 9 clock = 2474 queue_length = 9 clock = 2493 queue_length = 10 clock = 2566 queue_length = 10 clock = 2624 queue_length = 11 clock = 2695 queue_length = 10 clock = 2716 queue_length = 10 clock = 2762 queue_length = 10 clock = 2949 queue_length = 10 clock = 2996 queue_length = 11 clock = 3041 queue_length = 12 clock = 3057 queue_length = 13 clock = 3130 queue_length = 14 clock = 3178 queue_length = 14 clock = 3180 queue_length = 15 clock = 3297 queue_length = 16 clock = 3299 queue_length = 17 clock = 3493 queue_length = 16 clock = 3496 queue_length = 17 clock = 3512 queue_length = 18 clock = 3519 queue_length = 18 clock = 3776 queue_length = 16 clock = 4015 queue_length = 14 clock = 4105 queue_length = 13 clock = 4497 queue_length = 8 clock = 4518 queue_length = 9 clock = 4540 queue_length = 10 clock = 4542 queue_length = 11 clock = 4560 queue_length = 12 clock = 4574 queue_length = 13 clock = 4707 queue_length = 11 clock = 4762 queue_length = 12 clock = 5202 queue_length = 4 clock = 5233 queue_length = 5 clock = 5256 queue_length = 6 clock = 5257 queue_length = 7 clock = 5438 queue_length = 7 clock = 5465 queue_length = 8 clock = 5474 queue_length = 9 clock = 5598 queue_length = 10 clock = 5652 queue_length = 10 clock = 5666 queue_length = 11 clock = 5732 queue_length = 12 clock = 5785 queue_length = 13 clock = 5902 queue_length = 13 clock = 5946 queue_length = 14 clock = 6015 queue_length = 14 clock = 6023 queue_length = 15 clock = 6066 queue_length = 14 clock = 6071 queue_length = 15 clock = 6097 queue_length = 16 clock = 6237 queue_length = 15 clock = 6334 queue_length = 14 clock = 6354 queue_length = 15 clock = 6367 queue_length = 16 clock = 6382 queue_length = 17 clock = 6466 queue_length = 17 clock = 6538 queue_length = 16 clock = 6573 queue_length = 17 clock = 6638 queue_length = 18 clock = 6647 queue_length = 19 clock = 6668 queue_length = 20 clock = 6694 queue_length = 21 clock = 6710 queue_length = 22 clock = 6860 queue_length = 20 clock = 7026 queue_length = 17 clock = 7033 queue_length = 18 clock = 7125 queue_length = 19 clock = 7205 queue_length = 20 clock = 7415 queue_length = 18 clock = 7645 queue_length = 18 clock = 7686 queue_length = 18 clock = 7735 queue_length = 19 clock = 7737 queue_length = 20 clock = 7779 queue_length = 20 clock = 8034 queue_length = 19 clock = 8055 queue_length = 19 clock = 8065 queue_length = 20 clock = 8101 queue_length = 20 clock = 8313 queue_length = 19 clock = 8464 queue_length = 17 clock = 8509 queue_length = 18 clock = 8540 queue_length = 19 clock = 8541 queue_length = 20 clock = 8563 queue_length = 21 clock = 8566 queue_length = 22 clock = 8731 queue_length = 22 clock = 8847 queue_length = 21 clock = 8969 queue_length = 21 clock = 9171 queue_length = 21 clock = 9199 queue_length = 22 clock = 9351 queue_length = 21 clock = 9410 queue_length = 21 clock = 9499 queue_length = 19 clock = 9505 queue_length = 20 clock = 9623 queue_length = 18 clock = 9720 queue_length = 18 clock = 9784 queue_length = 18 clock = 9815 queue_length = 18 clock = 9886 queue_length = 19 clock = 10023 queue_length = 18 clock = 10075 queue_length = 18 clock = 10119 queue_length = 17 clock = 10121 queue_length = 17 clock = 10229 queue_length = 18 clock = 10315 queue_length = 19 clock = 10384 queue_length = 16 clock = 10519 queue_length = 15 clock = 10525 queue_length = 16 clock = 10621 queue_length = 17 clock = 10721 queue_length = 16 clock = 10744 queue_length = 14 clock = 10803 queue_length = 14 clock = 10804 queue_length = 15 clock = 10847 queue_length = 15 clock = 10918 queue_length = 16 clock = 10928 queue_length = 17 clock = 10965 queue_length = 17 clock = 10974 queue_length = 18 clock = 11182 queue_length = 12 clock = 11228 queue_length = 11 clock = 11323 queue_length = 12 clock = 11334 queue_length = 13 clock = 11350 queue_length = 14 clock = 11421 queue_length = 13 clock = 11460 queue_length = 13 clock = 11525 queue_length = 14 clock = 11634 queue_length = 14 clock = 11721 queue_length = 15 clock = 11824 queue_length = 15 clock = 11825 queue_length = 16 clock = 11845 queue_length = 17 clock = 12068 queue_length = 17 clock = 12109 queue_length = 16 clock = 12134 queue_length = 15 clock = 12294 queue_length = 13 clock = 12315 queue_length = 12 clock = 12435 queue_length = 12 clock = 12601 queue_length = 12 clock = 12636 queue_length = 13 clock = 12648 queue_length = 14 clock = 12712 queue_length = 14 clock = 12742 queue_length = 13 clock = 12758 queue_length = 14 clock = 12807 queue_length = 15 clock = 12815 queue_length = 16 clock = 12868 queue_length = 16 clock = 12931 queue_length = 16 clock = 13086 queue_length = 17 clock = 13239 queue_length = 17 clock = 13439 queue_length = 15 clock = 13573 queue_length = 15 clock = 13615 queue_length = 15 clock = 13655 queue_length = 15 clock = 13827 queue_length = 11 clock = 13983 queue_length = 12 clock = 13990 queue_length = 13 clock = 14034 queue_length = 14 clock = 14048 queue_length = 14 clock = 14079 queue_length = 15 clock = 14095 queue_length = 16 clock = 14117 queue_length = 17 clock = 14320 queue_length = 15 clock = 14479 queue_length = 14 clock = 14576 queue_length = 14 clock = 14596 queue_length = 15 clock = 14649 queue_length = 15 clock = 14681 queue_length = 15 clock = 14723 queue_length = 15 clock = 14809 queue_length = 16 clock = 14914 queue_length = 16 clock = 14965 queue_length = 17 clock = 15107 queue_length = 16 clock = 15187 queue_length = 17 clock = 15224 queue_length = 17 clock = 15290 queue_length = 18 clock = 15350 queue_length = 19 clock = 15419 queue_length = 20 clock = 15445 queue_length = 20 clock = 15578 queue_length = 21 clock = 15737 queue_length = 19 clock = 15748 queue_length = 19 clock = 15757 queue_length = 19 clock = 15759 queue_length = 20 clock = 15808 queue_length = 20 clock = 16105 queue_length = 18 clock = 16113 queue_length = 19 clock = 16298 queue_length = 16 clock = 16389 queue_length = 17 clock = 16410 queue_length = 18 clock = 16411 queue_length = 19 clock = 16412 queue_length = 20 clock = 16428 queue_length = 19 clock = 16473 queue_length = 18 clock = 16517 queue_length = 19 clock = 16596 queue_length = 19 clock = 16627 queue_length = 20 clock = 16636 queue_length = 21 clock = 16717 queue_length = 20 clock = 16842 queue_length = 19 clock = 17059 queue_length = 16 clock = 17075 queue_length = 17 clock = 17092 queue_length = 18 clock = 17135 queue_length = 19 clock = 17200 queue_length = 20 clock = 17275 queue_length = 20 clock = 17433 queue_length = 20 clock = 17622 queue_length = 19 clock = 17697 queue_length = 19 clock = 17762 queue_length = 20 clock = 17768 queue_length = 21 clock = 17856 queue_length = 21 clock = 17860 queue_length = 22 clock = 17884 queue_length = 22 clock = 17943 queue_length = 22 clock = 18019 queue_length = 21 clock = 18223 queue_length = 20 clock = 18273 queue_length = 19 clock = 18307 queue_length = 20 clock = 18353 queue_length = 21 clock = 18368 queue_length = 22 clock = 18369 queue_length = 23 clock = 18397 queue_length = 24 clock = 18514 queue_length = 25 clock = 18521 queue_length = 26 clock = 18682 queue_length = 23 clock = 18737 queue_length = 24 clock = 18777 queue_length = 24 clock = 18779 queue_length = 25 clock = 19016 queue_length = 22 clock = 19122 queue_length = 20 clock = 19138 queue_length = 21 clock = 19164 queue_length = 22 clock = 19195 queue_length = 22 clock = 19425 queue_length = 23 clock = 19429 queue_length = 24 clock = 19436 queue_length = 24 clock = 19531 queue_length = 22 clock = 19587 queue_length = 21 clock = 19616 queue_length = 22 clock = 19651 queue_length = 23 clock = 19752 queue_length = 23 clock = 19915 queue_length = 21 clock = 19963 queue_length = 22 clock = 19992 queue_length = 22 clock = 20012 queue_length = 22 clock = 20070 queue_length = 22 clock = 20113 queue_length = 23 clock = 20127 queue_length = 24 clock = 20171 queue_length = 25 clock = 20182 queue_length = 26 clock = 20267 queue_length = 26 clock = 20268 queue_length = 27 clock = 20269 queue_length = 28 clock = 20342 queue_length = 28 clock = 20348 queue_length = 29 clock = 20543 queue_length = 26 clock = 20683 queue_length = 26 clock = 20710 queue_length = 27 clock = 20795 queue_length = 28 clock = 20827 queue_length = 28 clock = 21063 queue_length = 22 clock = 21098 queue_length = 21 clock = 21236 queue_length = 22 clock = 21248 queue_length = 23 clock = 21285 queue_length = 22 clock = 21313 queue_length = 23 clock = 21319 queue_length = 24 clock = 21359 queue_length = 25 clock = 21560 queue_length = 25 clock = 21591 queue_length = 26 clock = 21618 queue_length = 26 clock = 21643 queue_length = 26 clock = 21914 queue_length = 26 clock = 21963 queue_length = 26 clock = 21973 queue_length = 27 clock = 22183 queue_length = 22 clock = 22210 queue_length = 23 clock = 22334 queue_length = 21 clock = 22372 queue_length = 22 clock = 22428 queue_length = 22 clock = 22450 queue_length = 23 clock = 22468 queue_length = 24 clock = 22482 queue_length = 25 clock = 22520 queue_length = 26 clock = 22556 queue_length = 27 clock = 22655 queue_length = 27 clock = 22665 queue_length = 28 clock = 22850 queue_length = 28 clock = 22943 queue_length = 27 clock = 22987 queue_length = 26 clock = 23236 queue_length = 26 clock = 23270 queue_length = 27 clock = 23282 queue_length = 28 clock = 23368 queue_length = 27 clock = 23419 queue_length = 28 clock = 23443 queue_length = 29 clock = 23557 queue_length = 29 clock = 23598 queue_length = 30 clock = 23650 queue_length = 31 clock = 23765 queue_length = 29 clock = 23890 queue_length = 29 clock = 23916 queue_length = 30 clock = 23964 queue_length = 30 clock = 24159 queue_length = 28 clock = 24322 queue_length = 28 clock = 24339 queue_length = 29 clock = 24394 queue_length = 29 clock = 24584 queue_length = 29 clock = 24619 queue_length = 30 clock = 24674 queue_length = 30 clock = 24675 queue_length = 31 clock = 24781 queue_length = 31 clock = 24992 queue_length = 30 clock = 25084 queue_length = 30 clock = 25098 queue_length = 31 clock = 25106 queue_length = 32 clock = 25147 queue_length = 31 clock = 25188 queue_length = 32 clock = 25272 queue_length = 33 clock = 25283 queue_length = 33 clock = 25349 queue_length = 32 clock = 25387 queue_length = 31 clock = 25412 queue_length = 32 clock = 25415 queue_length = 33 clock = 25464 queue_length = 34 clock = 25532 queue_length = 33 clock = 25658 queue_length = 33 clock = 25807 queue_length = 33 clock = 25866 queue_length = 33 clock = 26024 queue_length = 32 clock = 26090 queue_length = 33 clock = 26100 queue_length = 34 clock = 26106 queue_length = 35 clock = 26132 queue_length = 36 clock = 26226 queue_length = 37 clock = 26286 queue_length = 37 clock = 26344 queue_length = 37 clock = 26587 queue_length = 35 clock = 26754 queue_length = 34 clock = 26935 queue_length = 33 clock = 26962 queue_length = 34 clock = 26992 queue_length = 34 clock = 27047 queue_length = 34 clock = 27132 queue_length = 33 clock = 27279 queue_length = 31 clock = 27359 queue_length = 30 clock = 27390 queue_length = 30 clock = 27415 queue_length = 30 clock = 27470 queue_length = 30 clock = 27506 queue_length = 31 clock = 27854 queue_length = 27 clock = 27903 queue_length = 27 clock = 27954 queue_length = 28 clock = 28030 queue_length = 28 clock = 28098 queue_length = 27 clock = 28155 queue_length = 26 clock = 28275 queue_length = 25 clock = 28400 queue_length = 25 clock = 28430 queue_length = 26 clock = 28519 queue_length = 27 clock = 28544 queue_length = 28 clock = 28609 queue_length = 26 clock = 28838 queue_length = 25 clock = 28850 queue_length = 26 clock = 28922 queue_length = 26 clock = 29153 queue_length = 27 clock = 29188 queue_length = 28 clock = 29269 queue_length = 27 clock = 29350 queue_length = 27 clock = 29357 queue_length = 28 clock = 29469 queue_length = 26 clock = 29530 queue_length = 27 clock = 29550 queue_length = 28 clock = 29688 queue_length = 27 clock = 29716 queue_length = 28 clock = 29725 queue_length = 29 clock = 29842 queue_length = 30 clock = 29863 queue_length = 31 clock = 29921 queue_length = 32 clock = 29938 queue_length = 33 clock = 29945 queue_length = 34 clock = 29975 queue_length = 34 clock = 29990 queue_length = 35 clock = 30105 queue_length = 36 clock = 30301 queue_length = 34 clock = 30302 queue_length = 35 clock = 30437 queue_length = 36 clock = 30605 queue_length = 36 clock = 30618 queue_length = 37 clock = 30670 queue_length = 38 clock = 30729 queue_length = 38 clock = 30901 queue_length = 35 clock = 31109 queue_length = 31 clock = 31152 queue_length = 30 clock = 31232 queue_length = 30 clock = 31483 queue_length = 29 clock = 31558 queue_length = 29 clock = 31614 queue_length = 29 clock = 31622 queue_length = 30 clock = 31684 queue_length = 31 clock = 31685 queue_length = 32 clock = 31816 queue_length = 29 clock = 31855 queue_length = 30 clock = 31922 queue_length = 31 clock = 31931 queue_length = 32 clock = 32086 queue_length = 30 clock = 32095 queue_length = 31 clock = 32156 queue_length = 32 clock = 32179 queue_length = 32 clock = 32418 queue_length = 29 clock = 32430 queue_length = 30 clock = 32591 queue_length = 28 clock = 32618 queue_length = 29 clock = 32666 queue_length = 28 clock = 32688 queue_length = 29 clock = 32791 queue_length = 29 clock = 32850 queue_length = 28 clock = 32903 queue_length = 28 clock = 32908 queue_length = 29 clock = 32910 queue_length = 30 clock = 32918 queue_length = 30 clock = 32927 queue_length = 31 clock = 33005 queue_length = 32 clock = 33130 queue_length = 29 clock = 33232 queue_length = 28 clock = 33296 queue_length = 28 clock = 33313 queue_length = 29 clock = 33335 queue_length = 30 clock = 33336 queue_length = 31 clock = 33379 queue_length = 31 clock = 33523 queue_length = 30 clock = 33587 queue_length = 31 clock = 33661 queue_length = 28 clock = 33818 queue_length = 26 clock = 33897 queue_length = 26 clock = 33915 queue_length = 27 clock = 33979 queue_length = 28 clock = 34042 queue_length = 26 clock = 34178 queue_length = 26 clock = 34193 queue_length = 27 clock = 34372 queue_length = 25 clock = 34382 queue_length = 26 clock = 34408 queue_length = 27 clock = 34420 queue_length = 28 clock = 34854 queue_length = 24 clock = 35006 queue_length = 24 clock = 35029 queue_length = 24 clock = 35044 queue_length = 25 clock = 35136 queue_length = 26 clock = 35175 queue_length = 27 clock = 35322 queue_length = 27 clock = 35543 queue_length = 26 clock = 35756 queue_length = 26 clock = 35798 queue_length = 27 clock = 35824 queue_length = 27 clock = 35929 queue_length = 28 Average total time at deli 1681.9913043478261 Maximum time at deli 3230.0 Average queue length 20.583305555555555 Maximum queue length 38 Percent idle time clerk1 2.25 Percent idle time clerk2 2.077777777777778 dinner(): N guests sit down at a dinner table, without noticing the name tags. What are the chances that no one sits at their assigned seat? N P(derangement) 1 0 2 0.5 3 0.3333333333333333 4 0.375 5 0.3666666666666667 6 0.3680555555555556 7 0.3678571428571428 8 0.3678819444444444 9 0.367879188712522 10 0.3678794642857143 11 0.3678794392336059 12 0.3678794413212816 13 0.3678794411606912 14 0.3678794411721619 15 0.3678794411713971 16 0.367879441171445 17 0.3678794411714422 18 0.3678794411714424 19 0.3678794411714424 20 0.3678794411714423 dish(): Five dishwashers work together. Five dishes are broken. What are the chances that at least four of the dishes are broken by the same particular dishwasher? Probability dishwasher #1 breaks at least 4 out of 5 dishes = 0.006618 Theoretical probability is 0.00672 easywalk(): A pedestrian begins 1000 blocks east and 1000 blocks north of a destination. At each intersection, there is a stop light which is set randomly, and switches after 1 minute. Until reaching avenue 1 or street 1, the pedestrian always crosses the intersection in accordance with the stop light. Thereafter, the pedestrian must wait at each stop light encountered. What is the exact expected wait for stop lights? Use graphics to display the expected results. Graphics saved as "easywalk.png" election(): 2 voters participate in an election. n of the voters are candidates. Voting rules may allow a voter to vote for themselves, or not. 2 votes are required in order for a leader to be chosen. What is the probability that, on a single vote, a leader will be chosen? Probability a leader was selected = 1.0 election(): 3 voters participate in an election. n of the voters are candidates. Voting rules may allow a voter to vote for themselves, or not. 2 votes are required in order for a leader to be chosen. What is the probability that, on a single vote, a leader will be chosen? Probability a leader was selected = 0.77632 election(): 7 voters participate in an election. n of the voters are candidates. Voting rules may allow a voter to vote for themselves, or not. 4 votes are required in order for a leader to be chosen. What is the probability that, on a single vote, a leader will be chosen? Probability a leader was selected = 0.06002 election(): 2 voters participate in an election. n of the voters are candidates. Voting rules may allow a voter to vote for themselves, or not. 17 votes are required in order for a leader to be chosen. What is the probability that, on a single vote, a leader will be chosen? Probability a leader was selected = 0.10747 estimate(): N runners participate in a marathon. Each runner wears a tag with their index, from 1 to N. We observe the values of K of these tags. We want to estimate N. Produce illustrative plots for several cases. Graphics saved as "estimate.png" floss(): A person buys two rolls of dental floss. Each roll has 40 feet of floss. The person randomly selects a roll and takes 1 foot of floss. When one roll runs out, how many feet remain in the other roll? Average remaining floss = 7.1142303019125785 floss(): A person buys two rolls of dental floss. Each roll has 150 feet of floss. The person randomly selects a roll and takes 1 foot of floss. When one roll runs out, how many feet remain in the other roll? Average remaining floss = 13.808254325711056 forgetful_burglar(): In a town of 201 homes, a burglar starts at home 101. He randomly moves one or two homes left or right. What is the typical number of moves he will make before revisiting a home? K Prob(K) 1 0 2 0.249996 3 0.28133 4 0.195329 5 0.117183 6 0.0683116 7 0.0389018 8 0.0218607 9 0.0120899 10 0.0067145 Graphics saved as "fb.png" gameb(): In game B, you have two biased coins. If, at the time just before you decide to flip, your capital M is a multiple of 3 dollars, you chose coin 1, which shows heads with probability 1/10 - epsilon, otherwise you choose coin 2, which shows heads with probability 3/4 - epsilon. Game B is a losing game for you, and this code simply demonstrates that using many simulations. Produce a plot showing how the player loses. Graphics saved as "gameb.png" gs(): A building has 7 floors, and there are n elevators, each of which is at a randomly chosen floor. A person on floor 2 requests an elevator, wishing to go up. What is the probability that the first elevator to arrive is going down? Estimated probability of down elevator = 0.833738 Theoretical probability is 0.8333333333333333 gs(): A building has 7 floors, and there are n elevators, each of which is at a randomly chosen floor. A person on floor 2 requests an elevator, wishing to go up. What is the probability that the first elevator to arrive is going down? Estimated probability of down elevator = 0.721888 Theoretical probability is 0.7222222222222222 gs(): A building has 7 floors, and there are n elevators, each of which is at a randomly chosen floor. A person on floor 2 requests an elevator, wishing to go up. What is the probability that the first elevator to arrive is going down? Estimated probability of down elevator = 0.648546 Theoretical probability is 0.6481481481481481 guess_rank(): Given M = 24 items of ranks 1 through M, randomly guess the rank of each item. On average, how many ranks will we guess correctly? Average number of correct pairings = 1.000976 Expected value is 1. jury(): There are 5 judges on an appeals court. Each judge has a probability of making a correct ruling. What is the probability that a majority of the judges will rule incorrectly? Probability of a mistaken judgement = 0.0071095 kelvin(): A biased coin comes up heads with probability 0.4 To get a unbiased random value, toss the coin twice. If you get TH, call it heads if you get HT, call it tails. If you get TT or HH, do another double toss. On average, how many double tosses are necessary? Average number of double tosses = 2.0865 Theoretical value = 2.0833333333333335 malt(): Lil and Bill agree to meet in the malt shop between 3:30 and 4:00. Each arrives at a random time. Lil will wait 5 minutes, then leave. Bill will wait 7 minutes, then leave. What is the probability of a meeting? Estimated meeting probability = 0.358535 Theoretical probability is 0.3588888888888889 missing(): There are 100 senators. A bill needs a majority of present senators to pass. A = 49 senators are against the bill. M = 3 senators are missing the vote. What is the probability that the bill will be defeated? Probability of defeat = 0.129287 missing(): There are 100 senators. A bill needs a majority of present senators to pass. A = 49 senators are against the bill. M = 4 senators are missing the vote. What is the probability that the bill will be defeated? Probability of defeat = 0.06388 missing(): There are 100 senators. A bill needs a majority of present senators to pass. A = 49 senators are against the bill. M = 5 senators are missing the vote. What is the probability that the bill will be defeated? Probability of defeat = 0.19433 monotone(): Expected value of the number of random numbers that can be generated, which are monotone increasing. Extimated expected length = 2.717069 Theoretical value is 2.718281828459045 obtuse(): Define a "random" triangle as half of a rectangle with height 1 and width <= L. What are the chances the triangle is obtuse? Using value L = 1.0 Estimated likelihoood of obtuse triangle = 0.725312 Expected value = 0.7252064830064114 Using value L = 2.0 Estimated likelihoood of obtuse triangle = 0.79842 Expected value = 0.7983742851269212 obtuse1(): Define a "random" triangle by splitting the unit interval into three random pieces. What are the chances the triangle is obtuse? Estimated likelihoood of obtuse triangle = 0.079512 Theoretical value is 0.17055845832016425 optimal(): A dating club offers 11 potential partners. It turns out that any of #d of these partners would be acceptable. 2 The dater gets 1 date with each partner, but immediately after the date, must either marry that partner, or move to the next date. The dater plans to date a sample of the partners without a marriage offer, and then marry the next partner who is better than all the sample dates. As the sample size is varied, what are the chances of happiness? Use graphics to display result. Graphics saved as "optimal.png" optimal(): A dating club offers 50 potential partners. It turns out that any of #d of these partners would be acceptable. 5 The dater gets 1 date with each partner, but immediately after the date, must either marry that partner, or move to the next date. The dater plans to date a sample of the partners without a marriage offer, and then marry the next partner who is better than all the sample dates. As the sample size is varied, what are the chances of happiness? Use graphics to display result. Graphics saved as "optimal.png" patrol(): Consider a divided highway, and suppose it could be divided by a grassy median or a concrete barrier. Suppose 1 police cars patrol the highway. Suppose an accident occurs at a randomly chosen location and lane. Suppose all patrol cars immediately head towards the accident. If a grassy median, then patrol cars in the wrong lane can immediately reverse direction. For the concrete barrier, patrol cars in the wrong lane must continue to the end of the highway and then turn around. Estimate the average time required by a patrol car to reach the accident. Average grass distance = 0.33306372698439385 Average concrete distance = 0.9993494902313561 patrol(): Consider a divided highway, and suppose it could be divided by a grassy median or a concrete barrier. Suppose 2 police cars patrol the highway. Suppose an accident occurs at a randomly chosen location and lane. Suppose all patrol cars immediately head towards the accident. If a grassy median, then patrol cars in the wrong lane can immediately reverse direction. For the concrete barrier, patrol cars in the wrong lane must continue to the end of the highway and then turn around. Estimate the average time required by a patrol car to reach the accident. Average grass distance = 0.20825950767472043 Average concrete distance = 0.6666789057555836 patrol(): Consider a divided highway, and suppose it could be divided by a grassy median or a concrete barrier. Suppose 3 police cars patrol the highway. Suppose an accident occurs at a randomly chosen location and lane. Suppose all patrol cars immediately head towards the accident. If a grassy median, then patrol cars in the wrong lane can immediately reverse direction. For the concrete barrier, patrol cars in the wrong lane must continue to the end of the highway and then turn around. Estimate the average time required by a patrol car to reach the accident. Average grass distance = 0.14971978908471015 Average concrete distance = 0.5004717191969641 patrol(): Consider a divided highway, and suppose it could be divided by a grassy median or a concrete barrier. Suppose 4 police cars patrol the highway. Suppose an accident occurs at a randomly chosen location and lane. Suppose all patrol cars immediately head towards the accident. If a grassy median, then patrol cars in the wrong lane can immediately reverse direction. For the concrete barrier, patrol cars in the wrong lane must continue to the end of the highway and then turn around. Estimate the average time required by a patrol car to reach the accident. Average grass distance = 0.11667461028151091 Average concrete distance = 0.3997467434052011 patrol(): Consider a divided highway, and suppose it could be divided by a grassy median or a concrete barrier. Suppose 5 police cars patrol the highway. Suppose an accident occurs at a randomly chosen location and lane. Suppose all patrol cars immediately head towards the accident. If a grassy median, then patrol cars in the wrong lane can immediately reverse direction. For the concrete barrier, patrol cars in the wrong lane must continue to the end of the highway and then turn around. Estimate the average time required by a patrol car to reach the accident. Average grass distance = 0.09518124003821406 Average concrete distance = 0.3333455909461732 pierror(): Estimate pi by counting random points in the unit square which are also in the quarter circle. Points used = 100 Estimate for pi is 0.78 Absolute error is 2.361592653589793 pierror(): Estimate pi by counting random points in the unit square which are also in the quarter circle. Points used = 10000 Estimate for pi is 0.7928 Absolute error is 2.3487926535897934 ranking(): A list of M = 24 items is given. The test taker is required to give a rank for each. For each item, the test taker randomly chooses a value between 1 and M. What is the average number of correct rankings? Average number of correct matches = 1.000336 rhs(): Random Harmonic Series: Compute and histogram many values of the partial sums of sum ( 1 <= k < infinity ) t(i) / k where t(i) is randomly +1 or -1. Graphics saved as "rhs.png" rolls(): Two rolls of toilet paper are installed in a toilet, with 200 sheets. There are two kinds of people, with probabilities p and 1-p. * big choosers take one sheet from the larger roll * little choosers take one sheet from the smaller roll (unless empty). When one roll becomes empty, how many sheets are on the other roll? Use graphics to display results. Graphics saved as "rolls.png" smoker(): A smoker buys two packs of 40 matches. He then repeatedly selects a match from a randomly chosen pack. When one pack runs out, how many matches have been used in total? Average total number of matches used = 72.883948 Graphics saved as "smoker.png" smokerb(): A smoker buys two packs of 40 matches. He then repeatedly selects a match from a randomly chosen pack. At some point, the pack he chooses will be empty. How many matches have been used by then? Average total number of matches used = 73.796927 Graphics saved as "smokerb.png" spin(): A game involves two spinnable disks, each divided into three sectors. A player spins disk 1 or 2 according to the following rules: * if the player spins disk i, and it stops in region Pij, he moves from disk i to disk j * if the spinner stops in region Pi3, the game ends. * if the game ends in P13, the player wins. What is the probablity that the player, starting with disk 1, wins? Probabiity of winning = 0.6494 Theoretical value = 0.65 steve(): Steve gets on an elevator going up. There are 11 higher floors. Steve wishes to go up 9 floors. There are 0 additional riders in the elevator, each of whom has randomly chosen one of the 11 higher floors as destination. On average, how many times will the elevator stop until Steve reaches his floor? Estimated number of stops = 1.0 Theoretical number = 1.0 steve(): Steve gets on an elevator going up. There are 11 higher floors. Steve wishes to go up 9 floors. There are 1 additional riders in the elevator, each of whom has randomly chosen one of the 11 higher floors as destination. On average, how many times will the elevator stop until Steve reaches his floor? Estimated number of stops = 1.726768 Theoretical number = 1.7272727272727275 steve(): Steve gets on an elevator going up. There are 11 higher floors. Steve wishes to go up 9 floors. There are 2 additional riders in the elevator, each of whom has randomly chosen one of the 11 higher floors as destination. On average, how many times will the elevator stop until Steve reaches his floor? Estimated number of stops = 3.535914 Theoretical number = 2.3884297520661164 steve(): Steve gets on an elevator going up. There are 11 higher floors. Steve wishes to go up 9 floors. There are 3 additional riders in the elevator, each of whom has randomly chosen one of the 11 higher floors as destination. On average, how many times will the elevator stop until Steve reaches his floor? Estimated number of stops = 5.607196 Theoretical number = 2.989481592787379 steve(): Steve gets on an elevator going up. There are 11 higher floors. Steve wishes to go up 9 floors. There are 9 additional riders in the elevator, each of whom has randomly chosen one of the 11 higher floors as destination. On average, how many times will the elevator stop until Steve reaches his floor? Estimated number of stops = 8.996493 Theoretical number = 5.607219053020122 stopping(): From a population of 5 indexed values, the highest is sought. Values are to be discovered in order of index. When value I is discovered: * it may be rejected, and the next value discovered, or * it may be accepted, and the process is terminated. A strategy is to view S items in a row, and then accept the very next item that is larger than max(S). Given N, what is S, and what are the chances that this process will produce the maximum? Population size N = 5 Optimal sample size S = 2 Ratio N / S = 2.5 Probability of success = 0.4333333333333333 stopping(): From a population of 10 indexed values, the highest is sought. Values are to be discovered in order of index. When value I is discovered: * it may be rejected, and the next value discovered, or * it may be accepted, and the process is terminated. A strategy is to view S items in a row, and then accept the very next item that is larger than max(S). Given N, what is S, and what are the chances that this process will produce the maximum? Population size N = 10 Optimal sample size S = 3 Ratio N / S = 3.3333333333333335 Probability of success = 0.39869047619047615 stopping(): From a population of 20 indexed values, the highest is sought. Values are to be discovered in order of index. When value I is discovered: * it may be rejected, and the next value discovered, or * it may be accepted, and the process is terminated. A strategy is to view S items in a row, and then accept the very next item that is larger than max(S). Given N, what is S, and what are the chances that this process will produce the maximum? Population size N = 20 Optimal sample size S = 7 Ratio N / S = 2.857142857142857 Probability of success = 0.38420888000028863 stopping(): From a population of 50 indexed values, the highest is sought. Values are to be discovered in order of index. When value I is discovered: * it may be rejected, and the next value discovered, or * it may be accepted, and the process is terminated. A strategy is to view S items in a row, and then accept the very next item that is larger than max(S). Given N, what is S, and what are the chances that this process will produce the maximum? Population size N = 50 Optimal sample size S = 18 Ratio N / S = 2.7777777777777777 Probability of success = 0.3742750136479202 stopping(): From a population of 100 indexed values, the highest is sought. Values are to be discovered in order of index. When value I is discovered: * it may be rejected, and the next value discovered, or * it may be accepted, and the process is terminated. A strategy is to view S items in a row, and then accept the very next item that is larger than max(S). Given N, what is S, and what are the chances that this process will produce the maximum? Population size N = 100 Optimal sample size S = 37 Ratio N / S = 2.7027027027027026 Probability of success = 0.3710427787126428 sylvester_quadrilateral(): Estimate the probability that four points, chosen uniformly at random in the unit circle, form a concave (=nonconvex) quadrilateral. Estimated concave probability = 0.704287 Theoretical concave probability = 0.2955201189568185 umbrella(): A person has XI umbrellas at home, and YI at the office. With probability P, it will be raining at any given time. If it is raining, the person takes an umbrella from one place to the other. How many walks will the person take before running out of umbrellas? Use graphics to display results. Graphics saved as "umbrella.png" umbrella(): A person has XI umbrellas at home, and YI at the office. With probability P, it will be raining at any given time. If it is raining, the person takes an umbrella from one place to the other. How many walks will the person take before running out of umbrellas? Use graphics to display results. Graphics saved as "umbrella.png" walk(): A pedestrian begins M blocks east and M blocks north of a destination. At each intersection, there is a stop light which is set randomly, and switches after 1 minute. Until reaching avenue 1 or street 1, the pedestrian always crosses the intersection in accordance with the stop light. Thereafter, the pedestrian must wait at each stop light encountered. What is the average wait for stop lights? Estimated waiting time = 0.75125 walk(): A pedestrian begins M blocks east and M blocks north of a destination. At each intersection, there is a stop light which is set randomly, and switches after 1 minute. Until reaching avenue 1 or street 1, the pedestrian always crosses the intersection in accordance with the stop light. Thereafter, the pedestrian must wait at each stop light encountered. What is the average wait for stop lights? Estimated waiting time = 1.22924 walk(): A pedestrian begins M blocks east and M blocks north of a destination. At each intersection, there is a stop light which is set randomly, and switches after 1 minute. Until reaching avenue 1 or street 1, the pedestrian always crosses the intersection in accordance with the stop light. Thereafter, the pedestrian must wait at each stop light encountered. What is the average wait for stop lights? Estimated waiting time = 1.75987 walk(): A pedestrian begins M blocks east and M blocks north of a destination. At each intersection, there is a stop light which is set randomly, and switches after 1 minute. Until reaching avenue 1 or street 1, the pedestrian always crosses the intersection in accordance with the stop light. Thereafter, the pedestrian must wait at each stop light encountered. What is the average wait for stop lights? Estimated waiting time = 2.51708 walk(): A pedestrian begins M blocks east and M blocks north of a destination. At each intersection, there is a stop light which is set randomly, and switches after 1 minute. Until reaching avenue 1 or street 1, the pedestrian always crosses the intersection in accordance with the stop light. Thereafter, the pedestrian must wait at each stop light encountered. What is the average wait for stop lights? Estimated waiting time = 3.97575 walk(): A pedestrian begins M blocks east and M blocks north of a destination. At each intersection, there is a stop light which is set randomly, and switches after 1 minute. Until reaching avenue 1 or street 1, the pedestrian always crosses the intersection in accordance with the stop light. Thereafter, the pedestrian must wait at each stop light encountered. What is the average wait for stop lights? Estimated waiting time = 5.64014 digital_dice_test(): Normal end of execution. Tue May 20 21:35:01 2025