On Fri, 27 Oct 2006, Ruby Quiz wrote: > The Challenge > --------------------------------------------------------------------- > > Requirement #1: Write a Ruby program that shows the current time, but only the > 'tens' part of the minutes. For example, if the time is 10:37, then the program > might output "10:3~" > > Requirement #2: The time shown by the clock must randomly vary +/- 5 minutes > from reality. For example, if the time is actually 10:37, the program might > output "10:3~" or "10:4~" (but not "10:2~" or "10:5~"). > > Requirement #3: The time on the clock should continuously increase. If the time > shows "10:4~" it must continue to show "10:4~" until it shows "10:5~". (It can't > show "10:4~", then "10:3~" for a bit and then come back to "10:4~".) it seems like #2 and #3 contradict one another. imagine it's 10:45 and, through randomness, you choose to vary the clock by +5, therefore displaying 10:5~, you will not be able to change the output again until 10:55, and then only because the upper bould will have rolled over into the next hour. here it is in table form ----- ------ ----- --------- lower actual upper selection ----- ------ ----- --------- 10:40 10:45 10:50 10:50/5~ 10:41 10:46 10:51 10:51/5~ 10:42 10:47 10:52 10:52/5~ 10:43 10:48 10:53 10:53/5~ 10:44 10:49 10:54 10:54/5~ 10:45 10:50 10:55 10:55/5~ 10:46 10:51 10:56 10:56/5~ 10:47 10:52 10:57 10:57/5~ 10:48 10:53 10:58 10:58/5~ 10:49 10:54 10:59 10:59/5~ 10:50 10:55 11:00 11:00/0~ an initial high selection eats into subsequent ranges - in otherwords a selection of t+ means that #2 will not by able to hold: the variance will be required to b smaller for the next choice: a high selection eats the variance range of the next choice... it's possibly even worse when we not near the top of an hour and start of with maximum variance: ----- ------ ----- --------- lower actual upper selection ----- ------ ----- --------- 10:20 10:25 10:30 10:30/3~ 10:21 10:26 10:31 10:31/3~ 10:22 10:27 10:32 10:32/3~ 10:23 10:28 10:33 10:33/3~ 10:24 10:29 10:34 10:34/3~ 10:25 10:30 10:35 10:35/3~ 10:26 10:31 10:36 10:36/3~ 10:27 10:32 10:37 10:37/3~ 10:28 10:33 10:38 10:38/3~ 10:29 10:34 10:39 10:39/3~ 10:30 10:35 10:40 10:30/3~ 10:31 10:36 10:41 10:31/3~ 10:32 10:37 10:42 10:32/3~ 10:33 10:38 10:43 10:33/3~ 10:34 10:39 10:44 10:34/3~ 10:35 10:40 10:45 10:35/3~ 10:36 10:41 10:46 10:36/3~ 10:37 10:42 10:47 10:37/3~ 10:38 10:43 10:48 10:38/3~ 10:39 10:44 10:49 10:39/3~ 10:40 10:45 10:50 10:50/5~ so the combined effect means that it's acceptable to display the same time~ for twenty straight minutes - is that really the a desired potential effect? -a -- my religion is very simple. my religion is kindness. -- the dalai lama