VimGolf.com - real Vim ninjas count every keystroke
vimgolf.com
vimgolf.com
If anyone is up for it, would love some help with the client/parser: https://github.com/igrigorik/vimgolf
I've learned a LOT figuring out how some outstanding PE submissions worked, translating their algorithms to my favorite languages.
Only one wrinkle: you have to submit your own challenge to see the solutions.
Only thing is that the key counting doesn't seem to be consistent. :\ Using the command history seems to really, really screw with the counts. I thought it counted up all the characters in the submitted command, but this doesn't seem to be the case. I submitted an 18 for the "Sort and add attributes" challenge, then realized that the text for the new key is longer than that. :\
I'm not really clear on what "counts" as a keypress (shift key? colon for commands? Paste commands? Esc?) and I haven't been able to get any of my "scores" to match up with the count in my head.
All that aside, this is a barrel of fun, and I'm sure these kinks will get worked out.
(real Vim ninjas read man pages)
http://en.wikipedia.org/wiki/Perl#Perl_golf
'Golfing' different languages has been around for some time.
No discredit to the site though, certainly happy to have Vim golfing join the ranks.
Anyone have any ideas on how you'd implement this with emacs?
Maybe you could do something more along the lines of Perl golf, where you achieve certain things in as little code as possible.
Well, I just discovered that I had two different conflicting gem home dirs. was able to set GEM_HOME and do "gem cleanup" and things seem to be a bit better now. Yay!
I'm going to sorely miss it when I start working in other languages again.
I brought up this idea in a "gamification of software development" talk I gave last April.
I love this idea and love the challenge, but would love to make it less hackable as well.
jd2jVjj=f(ci)*a^]jcfda.join(',')^]
but it wont generalize anywhere. Having a full script though that will detect and do that automagically, now there's the fun part. 4JD=Gjwci(*a^]jcfda.join(',')^]
God this is addicting. Shaved off a few characters.edit: switch the first three letters to j3D, as 4JD seems to work differently between my two machines.
:g/#/+1s/\v(.*)\n.*/\1\r\1 ~wqave~2wq@aw2@ab~ws**^]l~fe~ww@afg@aZZ
(where ^] is an esc). Currently gets a score of 41 (although I only count 38 keystrokes...)I was trying to do this:
:s/./&\r/g|g/^/m0|j!
However, that causes a to be before b for some reason.So I ended up doing:
:s/./&\\r/g|g/^/m0\rV}gJ
Anyone know why appending j! joins everything correctly except a and b?I have scored 38 with:
:sor<ENTER>:%s/)/, :country => "USA")/<ENTER>
This shaves off a few chars: a) combining the commands b) leaving off the last / in the search/replace
16 :P
15
qa/v<ENTER>YpJDq@a@a
Of course I have remapped Y to be consistent with C, D, etc.
Or one, mapping space to @q is convenient :)
13
Edit: I can trim one more off, to make it 12:
qq3jYpJDq2@q
Of course, we aren't genuinely doing what the author intended. The point was not to copy-paste the line, but actually to perform what would be rather typical edits. I also was rather lucky that the file happened to be structured such that "3j" put the cursor in the right place each time.
It's also not clear whether or not the three times SHIFT must be pressed ("JD" = push and hold SHIFT = one press) should be counted as additional keystrokes.
The contest would have been better with a "tee" file and a "hole" file, stipulating that edits should be performed on the former in order to produce the latter.
Edit: Still a very cool project though
i1^]
qaYp
CTRL+a
q98@aggjjqaA Fizz^]
3jq32@agg:5
ENTER
qaA Buzz^]
5jq19@a:%s/z B/zB/
ENTER
ZZautocmd BufWritePre * :%s/\s\+$//
53 is the least I got.