POV-Ray : Newsgroups : povray.off-topic : It's a riddle Server Time
11 Oct 2024 07:12:01 EDT (-0400)
  It's a riddle (Message 23 to 32 of 62)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Invisible
Subject: Re: It's a riddle
Date: 7 Feb 2008 10:38:00
Message: <47ab25d8$1@news.povray.org>
Mike the Elder wrote:
> Orchid XP v7 <voi### [at] devnull> wrote:
>> "2.1.1 For the first 6 months of continuous employment the period of
>> notice to be given in writing by either you of the Company to terminate
>> your employment is one week's notice thereafter either party must give
>> at least four week's notice if you have been continuously employed for
>> up to four years and thereafter one additional week's notice for each
>> completed year of continuous service up to a maximum of 12 weeks' notice
>> after 12 years' service has been completed."

> #macro Find_Weeks_Notice(Years_Employed)
> 
>   #declare Weeks_Notice = 1;
> 
>   #if (Years_Employed > .5)
>     #declare Weeks_Notice = 4;
>   #end
> 
>   #if (Years_Employed > 4)
>     #declare Weeks_Notice = int(Years_Employed)
>   #end
> 
>   #if (Years_Employed > 12)
>     #declare Weeks_Notice = 12;
>   #end
> 
>   #debug concat("Weeks notice required: ",str(Weeks_Notice))
> 
> #end

OMG... That's like... sublime!

In fact, you know what? I think even *normal* people might be able to 
comprehend this code. w00t!

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: It's a riddle
Date: 7 Feb 2008 10:50:42
Message: <47ab28d2$1@news.povray.org>

>     #declare Weeks_Notice = int(Years_Employed)

I'm not sure if int is a valid function. Replace with ceil or floor (or 
round?) as appropriate; would make it more explicit.

>   #debug concat("Weeks notice required: ",str(Weeks_Notice))

Better design if the function returns the value it found, instead of 
printing it.

Also, you could have used #switch and #range; but I agree with 
Invisible: the way it's written now is clear even for non-coders...


Post a reply to this message

From: Mike the Elder
Subject: Re: It's a riddle
Date: 7 Feb 2008 11:00:00
Message: <web.47ab29fd5152fc42e2b2e7080@news.povray.org>
Invisible <voi### [at] devnull> wrote:

> OMG... That's like... sublime!

> In fact, you know what? I think even *normal* people might be able to
> comprehend this code. w00t!

My gosh, you're right!  We can't have THAT.  Crunch code to the rescue:

#macro Gen_WN(YE) #declare WN = 1+3*(YE>.5) + (YE>4) * int(YE-4) +( YE>12) *
int(12-YE); #debug concat("WN=",str(WN))#end


Much better.

BG,
MC


Post a reply to this message

From: Tom Austin
Subject: Re: It's a riddle
Date: 7 Feb 2008 11:02:54
Message: <47ab2bae$1@news.povray.org>
Jim Henderson wrote:
> On Wed, 06 Feb 2008 21:46:44 +0000, Orchid XP v7 wrote:
> 
>> I'm loving how they mix "week's" and "weeks'". Mmm, nice grammar.
> 
> Hey, I've been meaning to mention, you'd make a good writer.  Seriously, 
> you use the English language quite well.
> 
> Jim


He has a lot of practice writing to the newsgroup ;-0


Tom


Post a reply to this message

From: Invisible
Subject: Re: It's a riddle
Date: 7 Feb 2008 11:07:20
Message: <47ab2cb8$1@news.povray.org>
Mike the Elder wrote:
> Invisible <voi### [at] devnull> wrote:
> 
>> OMG... That's like... sublime!
> 
>> In fact, you know what? I think even *normal* people might be able to
>> comprehend this code. w00t!
> 
> My gosh, you're right!  We can't have THAT.  Crunch code to the rescue:
> 
> #macro Gen_WN(YE) #declare WN = 1+3*(YE>.5) + (YE>4) * int(YE-4) +( YE>12) *
> int(12-YE); #debug concat("WN=",str(WN))#end

GAH! >_<


find_weeks_notice :: Double -> Integer
find_weeks_notice years_worked
   | years_worked < 0.5 = 1
   | years_worked < 4   = 4
   | otherwise          = 12 `max` floor years_worked

Much better. :-D

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: It's a riddle
Date: 7 Feb 2008 11:11:51
Message: <47ab2dc7@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> In fact, you know what? I think even *normal* people might be able to 
> comprehend this code. w00t!

  #define "normal people"

-- 
                                                          - Warp


Post a reply to this message

From: Eero Ahonen
Subject: Re: It's a riddle
Date: 7 Feb 2008 11:53:09
Message: <47ab3775$1@news.povray.org>
Invisible wrote:

>> Besides, spelling and grammar checking are what editors are for. :-)
> 
> Heh! Who wants to be editor for my NG submissions? :-D

You're using Thunderbird, doesn't it have a live spell checking while
writing the message?

-- 
Eero "Aero" Ahonen
   http://www.zbxt.net
      aer### [at] removethiszbxtnetinvalid


Post a reply to this message

From: Darren New
Subject: Re: It's a riddle
Date: 7 Feb 2008 12:12:23
Message: <47ab3bf7$1@news.povray.org>
Warp wrote:
>   When I was in school they told us that in English "'s" should only be
> used with people, otherwise the "of" version should be used. For example,
> you shouldn't say "the house's window" but "the window of the house".

As a native speaker of American english, I will say I've never heard of 
such a rule. Indeed, such a "window of the house" would make me think 
you're a native French speaker speaking English or something.

>   OTOH, there are situations where it's clearly misused. For example,
> I have seen "not as scary as you two's faces", which sounds really awkward.
> I would say "not as scary as the faces of you two" would be much better.

Yeah, agreed. When it starts getting into complicated sentences, it's 
better to use "of", especially when the words are common homophones. It 
prevents the person from thinking you said "as you too's faces", which 
is confusing.

-- 
   Darren New / San Diego, CA, USA (PST)
     On what day did God create the body thetans?


Post a reply to this message

From: Darren New
Subject: Re: It's a riddle
Date: 7 Feb 2008 12:13:57
Message: <47ab3c55$1@news.povray.org>
Warp wrote:
> scott <sco### [at] laptopcom> wrote:
>> "not as scary as your two faces" sounds better to me.  No idea if it's 
>> correct or not.
> 
>   That would mean a person with two faces... :P

*Sounds* right to me. "Your" can refer to plural, so if it's clear from 
context you're talking to two people, it wouldn't be confusing.

(As for the its vs it's, yah, it's one of those things you just memorize.)

-- 
   Darren New / San Diego, CA, USA (PST)
     On what day did God create the body thetans?


Post a reply to this message

From: Mike the Elder
Subject: Re: It's a riddle
Date: 7 Feb 2008 12:25:00
Message: <web.47ab3e225152fc42e2b2e7080@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Invisible <voi### [at] devnull> wrote:
> > In fact, you know what? I think even *normal* people might be able to
> > comprehend this code. w00t!
>
>   #define "normal people"
>
> --
>                                                           - Warp

"just a normal human being. And you know what stinkers they are."
-Cab Driver from "Harvey"
(as played by Wallace Ford in the film version)

Oh So Pleasant Regards,
Mike C.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.