Real Vim ninjas count every keystroke - do you?

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

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

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 9v0064a68333000000000254

Find fix point of cos

Write a function to find the fix point of cos. It is not a good code; It is just to use vim. Inspired by the excellent https://mvanier.livejournal.com/2897.html about the Y combinator.

Start file
from math import cos


def find_cos_fix_point(j):
    a = 12.216
    for i in range(j):
        a = cos(a)

    print(a)


find_cos_fix_point(1)
End file
from math import cos


def find_cos_fix_point(j):
    a = 12.216
    for i in range(j):
        a = cos(a)

    print(a)


find_cos_fix_point(1)
find_cos_fix_point(10)
find_cos_fix_point(100)
find_cos_fix_point(1000)
find_cos_fix_point(10000)
find_cos_fix_point(100000)
find_cos_fix_point(1000000)
find_cos_fix_point(10000000)
find_cos_fix_point(100000000)

View Diff

12a13,20
> find_cos_fix_point(10)
> find_cos_fix_point(100)
> find_cos_fix_point(1000)
> find_cos_fix_point(10000)
> find_cos_fix_point(100000)
> find_cos_fix_point(1000000)
> find_cos_fix_point(10000000)
> find_cos_fix_point(100000000)

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 330 remaining solutions by signing in and submitting your own entry
#331 Sparrow He / @SparrowHe - Score: 240 - 08/07/23 @ 01:14
<Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down><Down>V<Left><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>ya<Down><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><CR>p<BS><Esc>p<BS><BS><Down><BS><Down>a<BS><Down><Left>0<Right>p<BS><Esc><Right><Right>ppppppa<Right><Up><Up><Up><Up><Up><Up><Down><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right>00<Down><Left>000<Down><Left>0000<Down><Left>00000<Up><Down><Down><Left>000000<Down><Left>0000000<Right><Esc><Right>ppa<Up><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Right><Left>00000000<Down><Left><Left><Right>000000000<Right><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><BS><Esc>:wq<CR>

0 comments


Created by: @zmf_tim

331 active golfers, 1113 entries

Leaderboard (lowest score wins):
27
#271 - Josh Pius / @JoshPius98

09/01/2023 at 03:29AM

27
#272 - Bro / @SpeorgNot

09/20/2023 at 09:36PM

29
#273 - Kaepa69 / @kaepa3

09/13/2023 at 02:19PM

30
#274 - Luca Iachini / @Codici89

08/28/2023 at 10:21AM

30
#275 - Benjamin Daniel Suarez / @benjaminsuarez

11/22/2023 at 11:25PM

30
#276 - FoxMoss / @FoxMoss

12/30/2023 at 12:33AM

31
#277 - Tobias Ho / @ho_tobias11007

08/08/2023 at 03:12PM

31
#278 - Kevin Wang / @VitamintK

12/25/2023 at 02:17AM

31
#279 - QuentindeA / @QuentindeA

02/03/2024 at 05:48PM

32
#280 - 村上企鹅 / @CO2NoTear

08/27/2023 at 02:29PM

32
#281 - CKRainbow / @CKRainbow

02/16/2024 at 06:39AM

34
#282 - Petter Dalen / @PetterDale51975

08/23/2023 at 02:02PM

36
#283 - Cyrus Kirk / @cyrusjkirk

08/11/2023 at 02:22PM

36
#284 - Dirli / @Dirli_V

08/18/2023 at 08:29AM

36
#285 - Mikołaj / @miko_aj4846

09/03/2023 at 03:04PM

36
#286 - GE / @GE5943034860462

09/25/2023 at 05:05PM

36
#287 - satake0916 / @satake0916

12/19/2023 at 03:50AM

36
#288 - lejeunel / @lejeunel

04/03/2024 at 12:49PM

37
#289 - dian wu / @Wudian9Wu

07/28/2023 at 04:35AM

38
#290 - erlend / @erlendogerling

07/11/2023 at 12:12PM

38
#291 - techtechtech / @techtechtech12

08/26/2023 at 12:52AM

38
#292 - Clay26 / @Clay26

04/06/2024 at 07:11PM

39
#293 - V / @account_test_k

07/12/2023 at 07:08AM

39
#294 - Jq / @corsac_ua

04/05/2024 at 11:31PM

40
#295 - Sophie Xu / @loveFluffy

12/10/2023 at 10:16PM

40
#296 - Zachary Peterson / @zpeterson16

01/15/2024 at 03:00PM

42
#297 - ATW / @viveremedices

09/11/2023 at 08:30PM

42
#298 - The Venereal Bede / @TheVenerealBede

03/20/2024 at 09:16PM

47
#299 - Jeffrey Chen / @Jeff_Chenster

09/09/2023 at 08:05PM

47
#300 - jferina / @jferina

03/29/2024 at 01:21AM