Here is a little something for those of you that fancy some cool coding:
int magic(int i) {
int j = 1337, k = 0;
do k -= i += (i<0 ? 1 : 0) + i;
while ((j *= 42) != 0);
return k;
}
What does the function magic do?
You will for sure know when you find the right answer, so please don't post it here and ruin the fun for somebody else :)
I will later today, or some other day, post some hints if you have problems with it (or you could send me a PM if you're impatient), and finally the solution as well I guess.
Good luck :flirty:
crash my laptop is what it did lol
doesn't really like php hehe
Haha :lmfao:
Try using a real programming language Jamoe, like Java or C :narnar:
hehe, I did convert it to php befor running it lol :flirty:
anyway, as I can't set apache to not ever time out and php runs out of numbers after 10 seconds I guess thats a clue. lol
Anyway, I cans see what its doing, just can't see the point lol.
Quote from: Bob;175349Haha :lmfao:
Try using a real programming language Jamoe, like Java or C :narnar:
what's wrong with Fortran?
Quote from: BlueBall;175353what's wrong with Fortran?
Nothing at all, but I couldn't list
all the "real" programming languages I know about, just took the first two that came to mind :)
Of course I could also have mentioned Fortran, Cobol, Pascal, Prolog, Lisp, Python, Assembly etc, but I didn't see the point :rolleyes:
Quote from: Jamoe;175351Anyway, I cans see what its doing, just can't see the point lol.
Seriously, can you
really see what it's doing, just by looking at the code :blink:
Either you're exceptionally bright, or you don't see what it actually does (meaning, what the "general" result of the function is) :g:
ADA, Eiffel, C# nice
Prolog = Evil
You need to run it to work that out?
For shame. Easy, NEXT.
Quote from: Bob;175356Seriously, can you really see what it's doing, just by looking at the code :blink:
Either you're exceptionally bright, or you don't see what it actually does (meaning, what the "general" result of the function is) :g:
the result of the function? u mean it actually has one?
Quote from: Jamoe;175359the result of the function? u mean it actually has one?
Yes indeed :rolleyes:
And a quite sensible result as well...
And the whole point for you is to figure out what (which Gandy obviously thinks is quite easy :blink:)...
lol so much for php, weakly typed languages ftl
I may have it wrong, but.... PM'ed
yea, i had forgotten that php will automaticaly convert ints to floats when they go over certain sizes.
thanks to Bob for the int tip, it finally makes sense. lol
:devil:
actually now that I got a little hint the output does fit a pattern ... though why you'd want that particular information is another matter...? :)
pm me the outcome i give up :P
Quote from: suicidal_monkey;175401actually now that I got a little hint the output does fit a pattern ... though why you'd want that particular information is another matter...? :)
And we can congratulate SM with the first correct answer :toast:
(At least the first one that PMed it to me...)
For those of you that are still struggling (and haven't already given up :narnar:), here is a good hint: think binary :flirty:
Here's my answer:
(http://www.thinkgeek.com/images/products/zoom/binary-people.jpg)
You're just grumpy cause you can't figure it out Duvel - I bet you probably belong to those that don't :norty:
Quote from: Bob;175409You're just grumpy cause you can't figure it out Duvel - I bet you probably belong to those that don't :norty:
I made the higher education with a 5 on my exam and was proud of it.
Me and maths: :doh:
I was hoping that I could win with my original answer...
it was very origional, i had to read the tshirt a 2nd time before i saw that 10 was really 2 so i probly won't find the answer of bob :(
Easy. The answer is: 42!
42? nah its 7!
Quote from: Luminance;17542542? nah its 7!
A poor Douglas Adams attempt... :rolleyes:
For you that still haven't figured it out, here comes the answer:
The function counts the number of 1s in the binary representation of the number you put into it :learn:
A quite weird way to do so if you ask me (and not sure if I can see too much practical use of it), but it's kinda cool :flirty: