Live data from Hacker News

Code Golf at Google

blog.zmxv.com

31–38 of 38 posts

Re: Code Golf at Google

#31
post #7

i think the sad pattern I see in a lot of these code golf implementations is the solution score is based on Lines of Code, which we already agree is a POOR representation of either complexity or simplicity. 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 lang…

The reason lines of code is a poor way to score solutions is that you should be counting characters ! :-) 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…

Once you know the other solution you can do much better than 80 characters!

Re: Code Golf at Google

#33
post #16

Earlier quoted context omitted.

You may be interested in http://www.zachtronics.com/tis-100/ . It's essentially a code golf game with many different metrics to optimize including number of instructions.

It's DRM-ed, sadly.

Not anymore: http://www.gog.com/game/tis100

Re: Code Golf at Google

#34
post #24

I'm trying to run the c++ version, but it won't compile because the loop variables in the range for loops do not have declarations.

There was a proposal[1][2] for C++17 to allow:

    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...

Re: Code Golf at Google

#35
post #30

I watched the wolf of wall street recently. I see some of the solutions to these code golf exercises as similar to the bankers who beat their chests and celebrate their masculinity in selling penny stocks to gullible investors.These code golf exercises seem like the software developer equivalent: "look at how brilliant and superior I am that I can obfusicate code into something no-one understands in only 2 lines". My…

Nice how many off-handed insults you've managed to pack into such small space, based on no data at all except extrapolating from your own prejudices. It's almost like some kind of HN comment golf. 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.…

Insult golf sounds kinda fun. Try to come up with the most insulting thing possible in the least characters.

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.

Re: Code Golf at Google

#36
post #2

> http://go/codegolf How does this work, some sort of TLD magic? (That shouldn't be possible, right?) Is it just routed within Google's internal network?

Search paths. The full address is go.corp.google.com (which is simply a URL shortener), IIRC; however, I think the resolvers are also configured to respond to a bare name in a lot of cases as an optimization. They talk a little bit about corp in their BeyondCorp paper[0], which is well worth a read, and I'm speaking to ancient memory so I might be wrong these days. [0]: http://static.googleusercontent.com/media/resea…

Thanks for the link! Figured it was a bit more complex than just a host file, being Google and all.

Re: Code Golf at Google

#37
I had to do a code test for a job (sigh). But it actually was kind of fun. The website takes your code and checks correctness and efficiencies.

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.

https://codility.com/programmers/lessons/

Post reply on HN