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

407 active golfers, 1388 entries

Leaderboard (lowest score wins):
15
#211 - Páll Pálsson / @DrLlap

03/26/2024 at 10:50AM

15
#212 - nightgather / @nightgather

03/28/2024 at 07:31AM

15
#213 - Andrey Rakhubovsky / @omnster

03/29/2024 at 09:23AM

15
#214 - かみひろ / @km_hr

03/30/2024 at 01:32AM

15
#215 - Marius Ropotica / @cipmar

03/30/2024 at 08:43AM

15
#216 - zoomhauer / @paulonhere

04/03/2024 at 05:13AM

15
#217 - vinay-sridhar / @vinay-sridhar

04/03/2024 at 11:23AM

15
#218 - Aly Thobani / @alythobani

04/03/2024 at 11:22PM

15
#219 - Antonio Migotto / @antoniomigotto

04/13/2024 at 11:34PM

15
#220 - logerse / @logerse

04/15/2024 at 06:07PM

15
#221 - Andy / @andyfoster

04/16/2024 at 11:20AM

15
#222 - Jelani Felix / @Jelanife

04/21/2024 at 05:54PM

15
#223 - bonettimrc / @bonettimrc

04/24/2024 at 05:06PM

15
#224 - constap / @constap

04/25/2024 at 04:07AM

15
#225 - Lennart / @lennartack

04/27/2024 at 12:07PM

15
#226 - x03n046 / @x03n046

05/02/2024 at 06:41AM

15
#227 - detachment1008 / @detachment1008

05/06/2024 at 12:23AM

15
#228 - Irakli Chigvaria / @tchigvaria

05/11/2024 at 11:03AM

15
#229 - kbrashem / @kbrashem

05/17/2024 at 10:25PM

15
#230 - Thermospore / @Thermospore

05/21/2024 at 06:40AM

15
#231 - nerfed / @nerfed

06/04/2024 at 01:34PM

15
#232 - ahenches / @ahenches

06/05/2024 at 10:29AM

15
#233 - Giacomo Sansone / @pcineverdies

07/01/2024 at 08:05PM

15
#234 - yexia0 / @yexia0

07/13/2024 at 09:28AM

15
#235 - Knaughty / @Kn4ughty

08/12/2024 at 12:16PM

15
#236 - Jonathan Schaaij / @jonathanschaaij

08/25/2024 at 03:42PM

15
#237 - Prem Netsuwan / @grnnja

08/26/2024 at 10:54PM

15
#238 - Petr Hodač / @PetrHodac

08/29/2024 at 08:56AM

15
#239 - Евгений Шевченко / @3530385

09/03/2024 at 04:38AM

15
#240 - KoroneListener / @KoroneListener

09/04/2024 at 03:06PM