Dev Shed Lounge
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDev Shed Lounge

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 6th, 2002, 03:42 PM
-=-steve-=- -=-steve-=- is offline
Devshed Gringo
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Toronto, Ontario
Posts: 417 -=-steve-=- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 12 m 20 sec
Reputation Power: 9
test?

What the hell I tried to solve this but I think I get the wrong answer! What does subject() output?

Define Compute_DA(x) {
temp = (x + 1) / 4;
if (temp >= 1) then
return x * Compute_DA(temp+1);
else //false
return x;
}

Define Subject() {
LookingFor = "Job";
Job = 'Good';
LaserRegistration = "Ultimate";
Programming = Get Pointer("Job");
Answer = Programming->;
Test = 'Job="' + LaserRegistration + 'Answer"'; Job="UltimateAnswer"
Evaluate(Test);
Solution = Job + "=" + Compute_DA(7);
return Solution;
}

I think it's Good=2
__________________
Where I work: scdesigner.ca

Reply With Quote
  #2  
Old March 6th, 2002, 07:18 PM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,301 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 1 h 52 m 9 sec
Reputation Power: 105
Send a message via ICQ to christo Send a message via Yahoo to christo
lang?

This might be a silly question, but

what language is this?



Christo

Reply With Quote
  #3  
Old March 6th, 2002, 09:05 PM
-=-steve-=- -=-steve-=- is offline
Devshed Gringo
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Toronto, Ontario
Posts: 417 -=-steve-=- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 12 m 20 sec
Reputation Power: 9
I don't have a clue? It was for a job application I sent them my answer but I don't know if they will write me back... Since I may so far off lol

Reply With Quote
  #4  
Old March 6th, 2002, 09:20 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 41 m 38 sec
Reputation Power: 89
Send a message via ICQ to Onslaught
If I am looking at it correctly, then it would return Good=1.5
The first macro is recursive, and stays recursive until it finds a value less than 1, which is 0.75, then multiplies it with the original value of the macro which is 2 so it comes out with 1.5.

Reply With Quote
  #5  
Old March 6th, 2002, 09:21 PM
christo's Avatar
christo christo is offline
Introspective
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Nov 2001
Location: London, UK
Posts: 3,301 christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level)christo User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Days 1 h 52 m 9 sec
Reputation Power: 105
Send a message via ICQ to christo Send a message via Yahoo to christo
so probably a chunk of pseudo.

compute_DA(x) is recursive and will reduce 7 to 1.5

then whatever all that pointer stuff in Subject() does, job is ultimately assigned the value of "UltimateAnswer" - that's just a string, innit?

So then solution would be:

UltimateAnswer=1.7,

or am I barking up completely the wrong dog?

Christo

Reply With Quote
  #6  
Old March 6th, 2002, 09:24 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 41 m 38 sec
Reputation Power: 89
Send a message via ICQ to Onslaught
You are right about the UltimateAnswer=1.5
I completely disregarded the reassign to Job.

Reply With Quote
  #7  
Old March 7th, 2002, 08:37 AM
-=-steve-=- -=-steve-=- is offline
Devshed Gringo
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: Toronto, Ontario
Posts: 417 -=-steve-=- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 12 m 20 sec
Reputation Power: 9
Thanks guys I needed to know this, it has been eating me alive. I have alot to learn about programming...

Reply With Quote
  #8  
Old September 6th, 2003, 05:52 AM
kuentin kuentin is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 kuentin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
sorry guys

I know it's been a long time ... but this test was re-used for a recent job application ....

The result of the recursive function is 42 !
7*3*2=42
I don't know how you can have another result ....

For the other function ... I think it's UltimateAnswer .... the pointer stuff is juste here to make the solution harder to find.

HTH

Kuentin

Last edited by kuentin : September 6th, 2003 at 05:57 AM.

Reply With Quote
  #9  
Old September 6th, 2003, 08:23 AM
Robin Bailey Robin Bailey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: South East of England
Posts: 11 Robin Bailey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This is fascinating! I looked at the 'problem' at first and basically thought I have to get out of programming! But then I looked again and did manage to get an answer.... it may well be wrong but I'm pleased I managed to get some kind of result, here goes:

UltimateAnswer=42

... I notice there is a certain kind of sense to this answer.

Reply With Quote
  #10  
Old September 6th, 2003, 11:39 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 41 m 38 sec
Reputation Power: 89
Send a message via ICQ to Onslaught
kuentin & Robin your both correct.
tbh I don't really know how I came up with 1.5.

Reply With Quote
  #11  
Old September 7th, 2003, 11:58 AM
a.koepke's Avatar
a.koepke a.koepke is offline
Second highest poster :p
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Jul 2001
Posts: 7,323 a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level)a.koepke User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 8 h 13 m 55 sec
Reputation Power: 27
Onslaught: it was over a year ago... who knows what you were thinking back then

Reply With Quote
  #12  
Old September 7th, 2003, 04:09 PM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 41 m 38 sec
Reputation Power: 89
Send a message via ICQ to Onslaught
lol, you know me.

Reply With Quote
  #13  
Old September 8th, 2003, 03:29 AM
Robin Bailey Robin Bailey is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: South East of England
Posts: 11 Robin Bailey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Feeling very pleased with myself for having worked this out the first time around, I looked at it again and for the life of me I couldn't work out the DA_Compute function to 42 again, I get the 21 but not the 2 to multiply it with, anyone care to explain?

Reply With Quote
  #14  
Old September 19th, 2003, 02:55 AM
kuentin kuentin is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 2 kuentin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
1st call to compute_DA:
x=7
temp=2
return 7*compute_DA(3) --> 3*2*7=42

2nd call to compute_DA:
x=3
temp=1
return 3*Compute_DA(2) --> 3*2

3rd call to compute_DA:
x=2
temp=3/4
return 2 -->2

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDev Shed Lounge > test?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump