So the problem here is not calculating hash functions per se, but over-fitting the solution to those test cases.
I think it would be far more interesting to measure number of instructions to complete the objective. Though I suspect the folks familiar with assembly would run circles, perhaps you could segment by solution language?
http://www.hugi.scene.org/compo/
That one seems abandoned for a few years now but you can find plenty of tiny graphical effects here, executables are 512 bytes and below:
http://www.pouet.net/prodlist.php?type%5B%5D=32b&type%5B%5D=...
My favorite Perl golf challenge is something I got from Boston Perl Mongers many years ago:
You have the numbers 1 to 9 (in order), and in between each number you can insert a plus, a multiply, or nothing. Your program should print all expressions that evaluate to 2002. For instance it should print the solution
1*23+45*6*7+89
(and one other)I have a command-line solution in 80 characters, including the `perl ` at the beginning. It works on 5.10 and 5.16. I think there was a better solution back in the 5.8 days, but my notes are unclear.
I agree what you describe would be fun, too, but it isn't code golf.
The company posts "challenges" every month. But they also have lessons which contain some interesting code challenges. The only problems is 1) they're timed 2) sometimes the descriptions are kinda mathy which may put people off.
for (e : c)
which would be equivalent to: for (auto &&e : c)
Gcc implements this when compiling with -std=c++1z. My understanding is that it was rejected by the committee.[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n385...
[2] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n399...
How does this work, some sort of TLD magic? (That shouldn't be possible, right?) Is it just routed within Google's internal network?
[0]: http://static.googleusercontent.com/media/research.google.co...
(You're going to see a login page that you can't authenticate to)
To get to go links, you've got to be connected to Google's network (either physically, or through VPN). It's essentially the same as accessing a computer on your LAN with its host name (in which case, the router can do the DNS lookup and resolution for the internal network).
My concern here is that this Code Golf mentality infects the normal day-to-day coding at Google. Just because an implementation can spawn a few lines it doesn't make it a good implementation. What about clean code, maintainability, automated testing, self documenting code...
I pity the codebase I would have to maintain from one of these code golfers.
A playful programming competition is really not at all comparable to cheating innocent people out of their money. Like, seriously. People are generally able to behave appropriately in situations with different expectations. There's no reason to think that it's not equally applicable to using the appropriate programming style for the project. It's like you're looking at somebody walking on the street in jeans and a T-shirt, and complaining that they're not properly dressed for the opera. And no code gets committed without a code review at Google anyway.
Finally, code golf is rarely about obfuscation; obfuscation just for its own sake isn't compatible with minimizing code length. Once you e.g. know the basic Perl golf tricks, the code can be surprisingly readable since it really just contains the core of the algorithm.
On a more serious note, I agree with you. There's some alarmist reactions to things like this, but in reality I don't think it's an issue at all. Sure, there might be bragging and such, but that's the point of something like this, isn't it? It's a game, not a serious discussion on optimization. Short code is more "fun" than superoptimized to my mind.
If people write a haiku
They might never stop.