
PhpGolf - solve problems in as few bytes as possible - thehodge
http://phpgolf.org/?p=main
======
ryanwaggoner
I understand why they wouldn't allow it for competitive reasons, but being
able to view others' code seems like it would be a great way to learn.

~~~
olegkikin
Everyone then would just submit variations of the winning solution, which
would make the leaderboard useless.

------
Deestan
Code golfing may seem like just a fun nerdy "sport", but it's actually really
useful practice in keeping your code terse and your unnecessary abstractions
to a minimum.

I recommend everyone to try to do _really well_ in a few code golfing
challenges.

<http://codegolf.com/> also accepts a couple more languages than PHP if that's
not your style.

~~~
photon_off
I would disagree. There's a point where code terseness and abstractionlessness
come at the cost of code readability, and these competitions cause you to go
way beyond this point. There's no sense in practicing how to write confusing
code that is very short, other than the problem-solving aspect of it.

I think code golf is just another form of a puzzle. So, whatever benefit you
get from solving a puzzle, or mind bender, or whatever, you'll get from code
golf. Hopefully you'll have the sense not to golf production code.

~~~
Deestan
I said " _practice_ in keeping your code terse". Actually trying to golf
production code would just be insane.

Programmers commonly put in completely unnecessary abstractions "just in
case", and a golfing mindset will help you avoid a lot of these.

------
bl4k
Most of these challenges test how good you are with regex hacking, rather than
general code or php.

To reach within a few points of the best score, for most challenges you need
regex

~~~
jacquesm
I tried very hard to resist the temptation to do that on the 99 bottles
problem because I suspect it's a dead-end.

It's down to 189 bytes now, I'm curious if someone will have beaten me by
morning.

That was fun to do. My first attempt was absolutely horrible :)

~~~
r13ckj
189?! I've been trying for ages and the best I can do is 233. Any pointers? I
can't compete with that, but would be great to have an idea why I'm so far off
:)

------
petervandijck
Code that focuses on being short is often pretty unreadable though, using
really short variable names, lots of unnecessary tricks, no comments and other
uglyness.

~~~
bartl
Yes. That's why it's a game, and not a serious programming practice.

~~~
petervandijck
Fair enough :)

------
stefs
whoever this "helge" guy is, if i should ever meet him, i'll slap him.

~~~
jacquesm
The way to slap him is to beat him.

~~~
stefs
that's impossible. i fear i have to resort to causing bodily harm because of
that.

~~~
jacquesm
Bad loser :)

Think of it as a challenge.

I'm just trying to figure out how he ever got to 55 on that primes challenge,
at least now I know that it's possible, all I have to do is figure out why.
It's a nice argument _for_ software patents actually (and this is coming from
someone that is morbidly against them), if you know that something is possible
but not how you should be able to figure out how it's done.

Bodily harm to someone that is simply better at you is so gradeschool :)

