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

348 active golfers, 1155 entries

Leaderboard (lowest score wins):
15
#91 - Kha Nguyen / @__ngtrongkha

07/16/2023 at 02:48PM

15
#92 - Afonso Sousa / @afonsobts

07/17/2023 at 12:53PM

15
#93 - Anonymous English Learner / @HoffmanDevs

07/18/2023 at 10:26AM

15
#94 - Alex / @AlexanderHeatl2

07/18/2023 at 05:50PM

15
#95 - Anshul Kamath / @anshul_kamath

07/20/2023 at 04:08PM

15
#96 - DocsSorted / @DocsSorted

07/21/2023 at 10:18PM

15
#97 - phastasmn / @phastasmn

07/22/2023 at 09:35AM

15
#98 - jinx balotchnik / @balotchnik

07/22/2023 at 06:01PM

15
#99 - PoltyPoltou / @PoltyP

07/22/2023 at 07:18PM

15
#100 - 선무 김 / @smKim9348279

07/23/2023 at 08:32AM

15
#101 - clark / @clark05358812

07/25/2023 at 01:39AM

15
#102 - Godek Dominik / @dominik27182818

07/25/2023 at 08:00PM

15
#103 - A. L. / @lnchk

07/26/2023 at 05:44PM

15
#104 - sap / @sap38838304

07/28/2023 at 05:27AM

15
#105 - Initness / @Initness1

07/29/2023 at 07:23AM

15
#106 - naka / @nak38223985244

07/30/2023 at 02:15AM

15
#107 - Casey O'Donnell / @CaseyOD15519082

08/04/2023 at 03:05PM

15
#108 - Aiden Yang / @aidenyangnn

08/07/2023 at 12:37PM

15
#109 - e1mnos / @e1mnos

08/07/2023 at 04:57PM

15
#110 - Selmir Aljic / @selmir_aljic

08/08/2023 at 02:20PM

15
#111 - omer vishlitzky / @OVishlitzky

08/09/2023 at 08:51PM

15
#112 - David :Duan / @WeijianDuan

08/10/2023 at 08:46AM

15
#113 - @mazunki@fosstodon.org / @me_mazunki

08/10/2023 at 06:22PM

15
#114 - Divvy C. / @divvy_c

08/11/2023 at 02:29PM

15
#115 - Blake Tereau / @BlakeTereau

08/12/2023 at 05:04PM

15
#116 - moh ayaya / @AyayaMoh

08/12/2023 at 06:14PM

15
#117 - Kaitlyn Ethylia / @EthyliaKaitlyn

08/17/2023 at 04:39PM

15
#118 - 'Dr' Joe Reddington / @JoeReddington

08/21/2023 at 11:34AM

15
#119 - uima / @luck07051

08/21/2023 at 01:31PM

15
#120 - MathijsHoogland / @MathijsHoogland

08/22/2023 at 02:44PM