Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Leaderboard, Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 4d1ba304c8bb5704eb00012d

Linear congruential generator

http://en.wikipedia.org/wiki/Linear_congruential_generator

Start file
a = 25
b = 7
m = 48
x0 = 0
x1 = (a * x0 + b) % m
x2 = (a * x1 + b) % m
...

|
v

End file
a = 25
b = 7
m = 48
x0 = 0
x1 = (a * x0 + b) % m
x2 = (a * x1 + b) % m
...

|
v

0
7
38
45
28
35
18
25
8
15
46
5
36
43
26
33
16
23
6
13
44
3
34
41
24
31
14
21
4
11
42
1
32
39
22
29
12
19
2
9
40
47
30
37
20
27
10
17
0

View Diff

11a12,60
> 0
> 7
> 38
> 45
> 28
> 35
> 18
> 25
> 8
> 15
> 46
> 5
> 36
> 43
> 26
> 33
> 16
> 23
> 6
> 13
> 44
> 3
> 34
> 41
> 24
> 31
> 14
> 21
> 4
> 11
> 42
> 1
> 32
> 39
> 22
> 29
> 12
> 19
> 2
> 9
> 40
> 47
> 30
> 37
> 20
> 27
> 10
> 17
> 0

Solutions

The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!

Check out these helpful resources to improve your Vim skills... Game on.

Unlock 30 remaining solutions by signing in and submitting your own entry
#31 matthewd / @_matthewd - Score: 45 - 12/29/10 @ 17:24
Go0<Esc>qqA<C-R>="\n".(25*getline('.')+7)%48<CR><Esc>q47@qZZ

0 comments

#32 Martin Aumueller / @aumuell - Score: 60 - 04/25/12 @ 14:42
<C-V>4jIlet <Esc>4Y:@"<CR>/1<CR>r0YGqqo<C-R>=x0<CR><Esc>:@"<CR>q48@q?0 =<CR>r1:%s/let //<CR>ZZ

0 comments

#33 Prody / @Prody225 - Score: 89 - 01/01/11 @ 09:51
Go0<Esc>qaYo<CR>=)<BS>(24<BS>5*@0+7()<BS><C-H>)%<Esc>Ot<Esc>Ox<Esc>dddd<kEnd>a48<BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><Esc>qqaYo<C-R>=(25*@0+7)%48<CR>q<BS><Esc>q47@aZZ

0 comments

#34 mightyfoo / @mightyfoo - Score: 95 - 05/26/11 @ 07:22
:fu F(x,n)<CR>if a:n>=0<CR>cal append(59-a:n, a:x)<CR>cal F((25*a:x+7)%48,a:n-1)<CR>en<CR>endf<CR>:cal F(0,48)|x<CR>

0 comments

#35 Kana Natsuno / @kana1 - Score: 105 - 12/29/10 @ 13:07
G:fu X()<CR>let x=0|let _=[]|for i in range(49)|cal add(_,x)|let x=(25*x+7)%48|endfo|retu _<CR>endf<CR>:put=X()<CR>ZZ

0 comments

#36 drio / @drio - Score: 107 - 01/05/11 @ 05:15
G:fu F()<CR>let x=0|let _=[]|for i in range(49)|cal add(_,x)|let x=(25*x+7)%48|endfo|retu _<CR>endf<CR>:put_<BS>=F()<CR>ZZ

0 comments

#37 Austin Taylor / @austintaylor - Score: 140 - 12/29/10 @ 13:13
Go0<CR>7<CR>38<CR>45<CR>28<CR>35<CR>18<CR>25<CR>8<CR>15<CR>46<CR>5<CR>36<CR>43<CR>26<CR>33<CR>16<CR>23<CR>6<CR>13<CR>44<CR>3<CR>34<CR>41<CR>24<CR>31<CR>14<CR>21<CR>4<CR>11<CR>42<CR>1<CR>32<CR>39<CR>22<CR>29<CR>12<CR>19<CR>2<CR>9<CR>40<CR>47<CR>30<CR>37<CR>20<CR>27<CR>10<CR>17<CR>0<Esc>ZZ

0 comments

#38 Indrek Juhkam / @indrekj - Score: 140 - 12/29/10 @ 13:26
Go0<CR>7<CR>38<CR>45<CR>28<CR>35<CR>18<CR>25<CR>8<CR>15<CR>46<CR>5<CR>36<CR>43<CR>26<CR>33<CR>16<CR>23<CR>6<CR>13<CR>44<CR>3<CR>34<CR>41<CR>24<CR>31<CR>14<CR>21<CR>4<CR>11<CR>42<CR>1<CR>32<CR>39<CR>22<CR>29<CR>12<CR>19<CR>2<CR>9<CR>40<CR>47<CR>30<CR>37<CR>20<CR>27<CR>10<CR>17<CR>0<Esc>ZZ

0 comments

Created by: @kana1

38 active golfers, 88 entries

Leaderboard (lowest score wins):
Shiraseon3_normal
30
#1 - Douglas Stockwell / @dstockwell

12/29/2010 at 06:45PM

Image_normal
30
#2 - Josh Weinberg / @jcweinberg

12/29/2010 at 08:03PM

Me-small_normal
30
#3 - Wei Dai / @clvv42

12/30/2010 at 04:24AM

6240_139454607906_723872906_3271730_5845230_n_normal
30
#4 - Alain Gilbert / @alain_gilbert

01/02/2011 at 10:51AM

Default_profile_6_normal
30
#5 - derp derp / @derp__

01/06/2011 at 05:03AM

The-milky-way-mardi-khola-007_normal
30
#6 - Ujjwol Lamichhane / @Ujjwol

01/06/2011 at 05:32AM

Dom-50_normal
30
#7 - dominique pellé / @vimgolfisto

01/06/2011 at 02:24PM

T_e_normal
30
#8 - Tim Chase / @gumnos

01/07/2011 at 01:11PM

Adept_normal
30
#9 - Balkoth / @_Balkoth_

01/08/2011 at 11:40AM

Image_normal
30
#10 - Pete Johns / @johnsyweb

01/09/2011 at 06:15PM

Untitled_normal
30
#11 - vg / @vimgolfer

02/26/2011 at 09:49AM

Jlove201003sq_normal
30
#12 - Justin Love / @wondible

06/18/2011 at 05:42AM

122_normal
30
#13 - not so punk :] / @notsopunk

06/19/2011 at 04:50AM

Avatar-small_normal
30
#14 - Hu Junfeng / @hujunfeng

07/18/2011 at 04:42AM

Gintoki_normal
30
#15 - You-Siang Lin / @yslinnctu

12/01/2011 at 06:20AM

Q6hrg93p4r3hn56thmd0_normal
30
#16 - Urtica dioica / @udioica

07/08/2012 at 01:14AM

4654945923_eb2c60ee5f_normal
30
#17 - Kerson Hsiao / @KersonHsiao

07/21/2012 at 04:37AM

40051_789281885907_29616532_44170636_2091417_n_normal
30
#18 - Conner McDaniel / @connermcd

09/18/2012 at 09:12PM

Dsc_0096_2_normal
30
#19 - Victor Ramirez / @virako

10/19/2012 at 06:04PM

Default_profile_1_normal
30
#20 - Hubba / @HubbaBubbaFett

12/25/2012 at 01:15PM

Default_profile_1_normal
30
#21 - a24f0600 / @a24f0600

01/23/2013 at 08:28AM

Image_normal
31
#22 - kmymtksh / @kmymtksh

01/01/2011 at 04:36AM

Bc879469f279ee24b7fbdfad7c2216d9_normal
31
#23 - 無ん垢の叫び / @john_ababa

03/10/2012 at 06:20AM

Mobile_photo_mar_15__2010_12_39_49_normal
31
#24 - Rod Knowlton / @codelahoma

05/27/2012 at 01:09PM

Rabbit_128_normal
32
#25 - uuu / @uu59

12/29/2010 at 01:44PM

Default_profile_3_normal
34
#26 - Mike Plotz / @antisuji

12/29/2010 at 05:21PM

Default_profile_4_normal
34
#27 - Aurélien Delahaye / @alkove

01/01/2011 at 05:42PM

264327_10150230576896345_729061344_7523848_5517118_n_normal
34
#28 - Nolen Royalty / @NolenRoyalty

04/23/2012 at 12:39AM

P1000007_normal
39
#29 - h_east (DDD ready) / @h_east

01/17/2011 at 07:27AM

Default_profile_5_normal
42
#30 - Brent Carmer / @brent_carmer

04/12/2013 at 10:53PM

E55df1cc7d5fdb4ae9bc2afcb9afe7e4_normal
45
#31 - matthewd / @_matthewd

12/29/2010 at 05:24PM

Twitter_normal
60
#32 - Martin Aumueller / @aumuell

04/25/2012 at 02:42PM

Default_profile_5_normal
89
#33 - Prody / @Prody225

01/01/2011 at 09:51AM

Foo-berk_normal
95
#34 - mightyfoo / @mightyfoo

05/26/2011 at 07:22AM

77e8ce774cb634d764d6c874fc5193a7_normal
105
#35 - Kana Natsuno / @kana1

12/29/2010 at 01:07PM

29ed1f20888463b3b72bd9fed88a79b8_normal
107
#36 - drio / @drio

01/05/2011 at 05:15AM

Twitter_normal
140
#37 - Austin Taylor / @austintaylor

12/29/2010 at 01:13PM

Ise_normal
140
#38 - Indrek Juhkam / @indrekj

12/29/2010 at 01:26PM