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 417 remaining solutions by signing in and submitting your own entry
#418 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

418 active golfers, 1408 entries

Leaderboard (lowest score wins):
62
#391 - wuwubean / @wuwubean

04/18/2024 at 06:48PM

64
#392 - James Reeder / @TheRealBreemer

08/20/2023 at 03:42PM

66
#393 - jack2023xxx / @jack2023xxx

08/21/2023 at 07:00AM

66
#394 - Swapnil Sharma / @mradul_swapnil

09/02/2023 at 10:47PM

66
#395 - KudoDD / @KudoDD

06/24/2024 at 06:50AM

69
#396 - Monty / @grdmnt

07/28/2023 at 02:55AM

70
#397 - tch1001 / @tch1001

07/18/2023 at 05:30PM

71
#398 - Jake Shomer / @jake_shomer

03/11/2024 at 03:23PM

73
#399 - Jake Shomer / @ShomerJake

08/07/2023 at 06:54PM

73
#400 - Pancho Cordero / @panchocorderos

11/30/2023 at 06:29PM

74
#401 - Kerry Wang / @kerrywang369

07/21/2023 at 08:58PM

75
#402 - Glen Curtis / @GlenCurtis2023

07/21/2023 at 12:38PM

78
#403 - Zhe Li / @ZheLi99

07/23/2023 at 12:20PM

82
#404 - ibrahim koz / @Ibrahmkoz

08/09/2023 at 04:38PM

83
#405 - Matt Shen / @mattshen

01/22/2024 at 08:39AM

85
#406 - PER / @ChenHua91464801

08/28/2023 at 04:07PM

86
#407 - LatteCafeGirl / @moithena

07/18/2023 at 08:20AM

101
#408 - aaalllthrowaway2 / @aaalllthro59419

08/24/2023 at 02:36PM

109
#409 - REEEhor / @reeehorwastaken

08/12/2023 at 12:30PM

109
#410 - JunHyeok Hong / @kongchu2

10/14/2024 at 07:18AM

114
#411 - Stephen Westhead / @CraziCrow

08/20/2023 at 03:35PM

115
#412 - Jon Kramer / @KrameNsuga

07/22/2023 at 05:13PM

140
#413 - Gaurav Bagwe / @grbagwe1

08/24/2023 at 09:24PM

147
#414 - DayuanX / @DayuanX

01/09/2024 at 09:05AM

159
#415 - José I. Escudero / @xjose97x

02/28/2024 at 01:59PM

182
#416 - Kshitij G 1 / @dragonfruitg44

09/10/2023 at 07:43PM

227
#417 - Ishan Khan / @Ishankhan21

04/01/2024 at 07:11AM

240
#418 - Sparrow He / @SparrowHe

08/07/2023 at 01:14AM