Golf Day 2


#1

From now on, I’ll commit the best from the previous day to the golf repo.

Com(m)a Trouble

Someone was real stupid when placing his commas. Can you fix it?

5ba020f91abf2d000951055c

Start File:

,0,1,2,3,4,5,6,7,89
,1,2,3,4,5,6,7,8,90
,2,3,4,5,6,7,8,9,01
,3,4,5,6,7,8,9,0,12
,4,5,6,7,8,9,0,1,23
56,7,8,9,0,1,2,3,4,
67,8,9,0,1,2,3,4,5,
78,9,0,1,2,3,4,5,6,
89,0,1,2,3,4,5,6,7,
90,1,2,3,4,5,6,7,8,

End File:

0,1,2,3,4,5,6,7,8,9
1,2,3,4,5,6,7,8,9,0
2,3,4,5,6,7,8,9,0,1
3,4,5,6,7,8,9,0,1,2
4,5,6,7,8,9,0,1,2,3
5,6,7,8,9,0,1,2,3,4
6,7,8,9,0,1,2,3,4,5
7,8,9,0,1,2,3,4,5,6
8,9,0,1,2,3,4,5,6,7
9,0,1,2,3,4,5,6,7,8

#2

14 (Vim has 13) 4Cd5jpgld5kP,q


#3

I ended up going a very different way.

%s,<ret>d%s\d<ret>a,<esc>gld,q

Which is 18… I think there are optimizations to still be made.


#4

%s,<ret>d%s\d<ret>pgld,q is 16, did not find anything better than eraserhd’s solution.