Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Guess if this will work

Author
Message
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 9th Apr 2005 15:48
I was playing around and thought, what the heck - I'll try somthing silly. Here's what I did:

Here's the game. Guess if this code will actually work (not crash) before trying to run it. Once you've made your guess - go for the bonus round; What will the output be? Be honest, post your guesses before running the code.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 9th Apr 2005 16:03 Edited at: 9th Apr 2005 16:06
Well after examining the code...I believe that:
1. Yes, it will work.
2. It will output:



*goes to run it

[EDIT]well, my screen cut off the output so i edited it to:

which i think should give the same thing....
...and...
darn am i good or what!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 10th Apr 2005 11:55
Right - now explain please, for us slow people.

Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 10th Apr 2005 13:26
well its confusing, but if you follow closely how it loops around you will notice that:

"test.x.y.x.y.z" and "test.x.y.z" are in fact the same attribute of test.

So it first sets this attribute to 1, then it sets it to 2, then it is printing out this "same attribute" twice.

If you can understand that
fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 10th Apr 2005 14:50
NOW I see it. The simple answer is:

Well, in both cases, it sets the variable Z, so it sets Z at the end to 2, so it must be:



But, obviously, there's more logic than that involved (as Apolloed explained)

www.war3forums.net

A.K.A Death Stalker
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 10th Apr 2005 15:12
It seems to me the whole thing is just plain wrong.

First, this code must be driving a pointer somewhere crazy, but it's managing to stay out of the pc insane asylumn.

Next, it seems the combination of .udt's is more important than the sequence or the quantity. Check this modified code.



Now, knowing kind-of how this works - guess this one. Will it work? What's the output?


"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 10th Apr 2005 15:26
wow that one is a little more complicated. Don't have the time to figure it out....but because you rigged it all up i will say it prints out differently than the last one.
fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 10th Apr 2005 16:41
It is different. "test" isn't being connected with text2 yet, so it can't work by giving it a test 2 type.

testing:

Who's good!

Quote: "Could not find field "a" in type "test1" at line 12"


www.war3forums.net

A.K.A Death Stalker
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 11th Apr 2005 01:21
So it seems the sequence has to be in order of Type and end with the correct .udt, but after that - all restrictions on order and quantity are off?

Now to really push this odd code:

My guess was that this wouldn't work because the .udt variables are reused. What's your guess? Outputs? Hold back on posting answers for bit. Have fun!

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 12th Apr 2005 05:13
I think it will be:

1
2

www.war3forums.net

A.K.A Death Stalker
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 12th Apr 2005 16:40 Edited at: 12th Apr 2005 16:40
Okay - here's a useful(?) snippet:

The Ultimate Global Variable:



"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
Ace Of Spades
20
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 12th Apr 2005 20:47
You enjoy confusing us don't you?
fasdfsdaf
20
Years of Service
User Offline
Joined: 17th Jan 2005
Location:
Posted: 13th Apr 2005 09:36
all three printed in order

www.war3forums.net

A.K.A Death Stalker

Login to post a reply

Server time is: 2025-05-18 04:43:14
Your offset time is: 2025-05-18 04:43:14