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

356 active golfers, 1173 entries

Leaderboard (lowest score wins):
15
#181 - cykirk / @cykirk

01/15/2024 at 03:43AM

15
#182 - Sami Tabet / @sfluor

01/18/2024 at 01:27PM

15
#183 - anranlee99 / @anranlee99

01/22/2024 at 08:42AM

15
#184 - diwa / @LuoDi-Nate

02/02/2024 at 08:10AM

15
#185 - 221300034gzx / @221300034gzx

02/03/2024 at 02:44PM

15
#186 - Ben Gadbois / @bengadbois

02/04/2024 at 01:07AM

15
#187 - ydbB / @ydbB

02/04/2024 at 04:29PM

15
#188 - omgwei / @omgwei

02/06/2024 at 07:13PM

15
#189 - Steve Shi / @steveshi7

02/10/2024 at 05:13AM

15
#190 - Penbu / @penbuvt

02/16/2024 at 02:01AM

15
#191 - evgenii-kokorin / @evgenii-kokorin

02/16/2024 at 01:42PM

15
#192 - pajamaman7 aka tommyBuckets / @pajamaman7

02/22/2024 at 07:11PM

15
#193 - Anaritus / @Anaritus

02/23/2024 at 12:24AM

15
#194 - jbr46 / @jbr46

03/09/2024 at 09:04PM

15
#195 - Let-me-C / @Let-me-C

03/10/2024 at 08:32PM

15
#196 - Baptiste Nicolet / @bathal1

03/14/2024 at 01:23PM

15
#197 - Brian Curless / @swirlycurly

03/14/2024 at 11:37PM

15
#198 - Aristotelis Dossas / @teldosas

03/24/2024 at 06:13PM

15
#199 - zxalone / @zxalone

03/25/2024 at 08:23AM

15
#200 - Páll Pálsson / @DrLlap

03/26/2024 at 10:50AM

15
#201 - nightgather / @nightgather

03/28/2024 at 07:31AM

15
#202 - Andrey Rakhubovsky / @omnster

03/29/2024 at 09:23AM

15
#203 - かみひろ / @km_hr

03/30/2024 at 01:32AM

15
#204 - Marius Ropotica / @cipmar

03/30/2024 at 08:43AM

15
#205 - zoomhauer / @paulonhere

04/03/2024 at 05:13AM

15
#206 - vinay-sridhar / @vinay-sridhar

04/03/2024 at 11:23AM

15
#207 - Aly Thobani / @alythobani

04/03/2024 at 11:22PM

15
#208 - Peppa Pig / @PeppaPi95550250

04/09/2024 at 02:50AM

15
#209 - Antonio Migotto / @antoniomigotto

04/13/2024 at 11:34PM

15
#210 - logerse / @logerse

04/15/2024 at 06:07PM