[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: [QUIZ] Micrrowave Numbers (#118

Warren Brown

3/30/2007 2:12:00 PM

James,

> # 120 seconds is 2 minutes, and 200 is slightly less
> movement than 120
> microwave(120) => 200
>
> # 123 seconds is 2:03, but 203 is a lot more distance
> microwave(123) => 123

How is the microwave supposed to know that "120" is 120 seconds but
"200" is two minutes? My experience is that microwaves will interpret
two-digit numbers as seconds and three-digit numbers as minutes and
seconds. Therefore, "99" is 99 seconds, but "120" is one minute, twenty
seconds. Am I missing something?

- Warren Brown


6 Answers

James Gray

3/30/2007 2:18:00 PM

0

On Mar 30, 2007, at 9:11 AM, Brown, Warren wrote:

> James,
>
>> # 120 seconds is 2 minutes, and 200 is slightly less
>> movement than 120
>> microwave(120) => 200
>>
>> # 123 seconds is 2:03, but 203 is a lot more distance
>> microwave(123) => 123
>
> How is the microwave supposed to know that "120" is 120 seconds
> but
> "200" is two minutes? My experience is that microwaves will interpret
> two-digit numbers as seconds and three-digit numbers as minutes and
> seconds. Therefore, "99" is 99 seconds, but "120" is one minute,
> twenty
> seconds. Am I missing something?

Hmm, these are good points. Let's just focus on the two number
scenarios for the purpose of this quiz then.

James Edward Gray II

Jamie Macey

3/30/2007 2:43:00 PM

0

On Fri, 30 Mar 2007 23:17:55 +0900
James Edward Gray II <james@grayproductions.net> wrote:
> On Mar 30, 2007, at 9:11 AM, Brown, Warren wrote:
>
> > James,
> >
> >> # 120 seconds is 2 minutes, and 200 is slightly less
> >> movement than 120
> >> microwave(120) => 200
> >>
> >> # 123 seconds is 2:03, but 203 is a lot more distance
> >> microwave(123) => 123
> >
> > How is the microwave supposed to know that "120" is 120
> > seconds but
> > "200" is two minutes? My experience is that microwaves will
> > interpret two-digit numbers as seconds and three-digit numbers as
> > minutes and seconds. Therefore, "99" is 99 seconds, but "120" is
> > one minute, twenty
> > seconds. Am I missing something?
>
> Hmm, these are good points. Let's just focus on the two number
> scenarios for the purpose of this quiz then.

It's still possible to use larger numbers, just a bit of math is needed.

For example, 4:09 can also be 3:69, with the latter being a much
shorter distance. On the flip side, compare 12:33 with 11:93, where
the former is shorter.

--
Jamie

James Gray

3/30/2007 2:45:00 PM

0

On Mar 30, 2007, at 9:42 AM, Jamie Macey wrote:

> On Fri, 30 Mar 2007 23:17:55 +0900
> James Edward Gray II <james@grayproductions.net> wrote:
>> On Mar 30, 2007, at 9:11 AM, Brown, Warren wrote:
>>
>>> James,
>>>
>>>> # 120 seconds is 2 minutes, and 200 is slightly less
>>>> movement than 120
>>>> microwave(120) => 200
>>>>
>>>> # 123 seconds is 2:03, but 203 is a lot more distance
>>>> microwave(123) => 123
>>>
>>> How is the microwave supposed to know that "120" is 120
>>> seconds but
>>> "200" is two minutes? My experience is that microwaves will
>>> interpret two-digit numbers as seconds and three-digit numbers as
>>> minutes and seconds. Therefore, "99" is 99 seconds, but "120" is
>>> one minute, twenty
>>> seconds. Am I missing something?
>>
>> Hmm, these are good points. Let's just focus on the two number
>> scenarios for the purpose of this quiz then.
>
> It's still possible to use larger numbers, just a bit of math is
> needed.
>
> For example, 4:09 can also be 3:69, with the latter being a much
> shorter distance. On the flip side, compare 12:33 with 11:93, where
> the former is shorter.

Good point.

James Edward Gray II

matthew.moss.coder

3/30/2007 3:00:00 PM

0

On 3/30/07, Brown, Warren <warrenbrown@aquire.com> wrote:
> James,
>
> > # 120 seconds is 2 minutes, and 200 is slightly less
> > movement than 120
> > microwave(120) => 200
> >
> > # 123 seconds is 2:03, but 203 is a lot more distance
> > microwave(123) => 123
>
> How is the microwave supposed to know that "120" is 120 seconds but
> "200" is two minutes? My experience is that microwaves will interpret
> two-digit numbers as seconds and three-digit numbers as minutes and
> seconds. Therefore, "99" is 99 seconds, but "120" is one minute, twenty
> seconds. Am I missing something?


I think the confusion is that I specified input and output to both be
integers, but they don't really mean the same thing.

Input is always seconds... two minutes is "120", five minutes is
"600". Input is NOT the keys you would press.

Output is always the keys to press... It would have been clearer,
perhaps, if I requested the output as an array such as [1, 2, 0,
:cook], or even a string like "120*". When I proposed the problem, I
realized that the "*" (cook) button is always part of the output, so I
could have the function return an integer and the "*" would be
implicit. But this, I think, confused things.

So 120 (or "120*") as output means to push, in order, the buttons 1,
2, 0 and *. Which, for a microwave means 1:20, or 80 seconds.

Does this clear things up?

matthew.moss.coder

3/30/2007 3:30:00 PM

0

On 3/30/07, Brown, Warren <warrenbrown@aquire.com> wrote:
> James,
>
> > # 120 seconds is 2 minutes, and 200 is slightly less
> > movement than 120
> > microwave(120) => 200
> >
> > # 123 seconds is 2:03, but 203 is a lot more distance
> > microwave(123) => 123
>
> How is the microwave supposed to know that "120" is 120 seconds but
> "200" is two minutes? My experience is that microwaves will interpret
> two-digit numbers as seconds and three-digit numbers as minutes and
> seconds. Therefore, "99" is 99 seconds, but "120" is one minute, twenty
> seconds. Am I missing something?

The input is always "desired seconds", so 200 as input means 3 mins,
20 secs, and 120 as input means 2 mins.

The output is always "buttons to press", so 200 as output always means
2:00, and 120 _as output_ means 1:20.

And the convention for this quiz (not well specified, sorry) is that
if the buttons I press on the microwave are 170, the microwave will
treat that as 1:70... it will first countdown 70 seconds to 1:00,
then 0:59, 0:58... etc.

Ken Bloom

3/30/2007 6:38:00 PM

0

On Fri, 30 Mar 2007 23:11:45 +0900, Brown, Warren wrote:

> James,
>
>> # 120 seconds is 2 minutes, and 200 is slightly less movement than 120
>> microwave(120) => 200
>>
>> # 123 seconds is 2:03, but 203 is a lot more distance microwave(123) =>
>> 123
>
> How is the microwave supposed to know that "120" is 120 seconds but
> "200" is two minutes? My experience is that microwaves will interpret
> two-digit numbers as seconds and three-digit numbers as minutes and
> seconds. Therefore, "99" is 99 seconds, but "120" is one minute, twenty
> seconds. Am I missing something?
>
> - Warren Brown

Here's a thought: for times from 0-99 seconds, determine the fastest way
of typing those times.

For times above 99 seconds, do as follows:
min,sec=thetime.divmod(60)
min-=1
sec+=60
and compute the distances that way.


--
Ken Bloom. PhD candidate. Linguistic Cognition Laboratory.
Department of Computer Science. Illinois Institute of Technology.
http://www.iit.edu...