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

181 active golfers, 648 entries

Leaderboard (lowest score wins):
37
#151 - dian wu / @Wudian9Wu

07/28/2023 at 04:35AM

38
#152 - erlend / @erlendogerling

07/11/2023 at 12:12PM

38
#153 - techtechtech / @techtechtech12

08/26/2023 at 12:52AM

39
#154 - V / @account_test_k

07/12/2023 at 07:08AM

42
#155 - ATW / @viveremedices

09/11/2023 at 08:30PM

47
#156 - Jeffrey Chen / @Jeff_Chenster

09/09/2023 at 08:05PM

48
#157 - Teh Shin Yin / @teh_yin

08/28/2023 at 05:52AM

49
#158 - Grow Together / @growtechies

08/11/2023 at 01:32AM

52
#159 - Keveno123 / @Keveno123

07/31/2023 at 10:22PM

54
#160 - 황현 / @ghkdgus29

09/02/2023 at 04:40AM

59
#161 - michan@RUNTEQ43期生 / @yuta43RUNTEQ

07/22/2023 at 11:56AM

59
#162 - GE / @GE5943034860462

08/08/2023 at 05:37PM

64
#163 - James Reeder / @TheRealBreemer

08/20/2023 at 03:42PM

66
#164 - jack2023xxx / @jack2023xxx

08/21/2023 at 07:00AM

66
#165 - Swapnil Sharma / @mradul_swapnil

09/02/2023 at 10:47PM

69
#166 - Monty / @grdmnt

07/28/2023 at 02:55AM

70
#167 - tch1001 / @tch1001

07/18/2023 at 05:30PM

73
#168 - Jake Shomer / @ShomerJake

08/07/2023 at 06:54PM

74
#169 - Kerry Wang / @kerrywang369

07/21/2023 at 08:58PM

75
#170 - Glen Curtis / @GlenCurtis2023

07/21/2023 at 12:38PM

78
#171 - Zhe Li / @ZheLi99

07/23/2023 at 12:20PM

82
#172 - ibrahim koz / @Ibrahmkoz

08/09/2023 at 04:38PM

85
#173 - PER / @ChenHua91464801

08/28/2023 at 04:07PM

86
#174 - LatteCafeGirl / @moithena

07/18/2023 at 08:20AM

101
#175 - aaalllthrowaway2 / @aaalllthro59419

08/24/2023 at 02:36PM

109
#176 - REEEhor / @reeehorwastaken

08/12/2023 at 12:30PM

114
#177 - Stephen Westhead / @CraziCrow

08/20/2023 at 03:35PM

115
#178 - Jon Kramer / @KrameNsuga

07/22/2023 at 05:13PM

140
#179 - Gaurav Bagwe / @grbagwe1

08/24/2023 at 09:24PM

182
#180 - Kshitij G 1 / @dragonfruitg44

09/10/2023 at 07:43PM