Suggestion for a second scoring system: token play

Add a reply

Posted by mick 672 days ago:
Just like there are multiple ways of scoring golf (total strokes or 'skins' play), I'd like to suggest an alternate scoring system: compiler tokens. So the line "list.reverse" might be three tokens: 'list', '.', and 'reverse'. "x+=y" could be three, if "+=" is a single token.

This would put slightly more verbose languages on a par with less verbose languages, and might yield interesting tradeoffs in submissions. For example, in Python, you might want to submit two different solutions:

x[::-1] ==> 7 characters, 6 or 7 tokens: 'x', '[', ':', ':', '-1', ']' (would '-1' be one or two tokens?)
x.reverse() ==> 11 characters, 5 tokens: 'x', '.', 'reverse', '(', ')'

It would be interesting to see if the programs currently scoring lowest in 'stroke play' are also the lowest in 'token play'!

I expect that there would be some contention as to what a 'token' is: we could start with keywords and work our way to include other things.

Any opinions on this?
Posted by toxik 360 days ago:
I'd rather see statement counts, not really for competition, but rather for the stats - I find it that when I want to write short code, I want to stick to one long statement.

Add a reply