Chinese Multiplication Table
Print a Chinese multiplication table in Vim. In China, every kid is asked to memorize this table. And thanks to the mono-syllabism of Chinese characters, it is not that hard. Printing the multiplication table is also a good exercise for programming beginners. For-loop, escaped characters, etc... There should be some special ways to print it in Vim.
Start file
1*1=1
End file
1*1=1
1*2=2 2*2=4
1*3=3 2*3=6 3*3=9
1*4=4 2*4=8 3*4=12 4*4=16
1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81
View Diff
1a2,9
> 1*2=2 2*2=4
> 1*3=3 2*3=6 3*3=9
> 1*4=4 2*4=8 3*4=12 4*4=16
> 1*5=5 2*5=10 3*5=15 4*5=20 5*5=25
> 1*6=6 2*6=12 3*6=18 4*6=24 5*6=30 6*6=36
> 1*7=7 2*7=14 3*7=21 4*7=28 5*7=35 6*7=42 7*7=49
> 1*8=8 2*8=16 3*8=24 4*8=32 5*8=40 6*8=48 7*8=56 8*8=64
> 1*9=9 2*9=18 3*9=27 4*9=36 5*9=45 6*9=54 7*9=63 8*9=72 9*9=81
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.
#26 David Wales / @selawdivad - Score: 687 - 02/04/13 @ 04:09
ylll<Esc>uuhhyljo<Esc>p<Esc>uuuy2lp<Esc>uPujo<Esc>pa2=2 <Esc>o<Esc>p<Esc>yypppppp<Esc>:2<CR>$h#y3ljlpj.j.j.j.j.j.<Esc>:3<CR>2l:s/2/3/g<CR>j:<Up><Left><Left><BS>4<CR>j:<Up><Left><Left><BS>5<CR>j:<Up><Left><Left><BS>6<CR>:<Esc>j:<Up><Left><Left><BS>7<CR>j:<Up><Left><Left><BS>8<CR>j:<Up><Left><Left><BS>9<CR>:2<CR>$a2*2=4<Esc>hhhhy2l<Esc>j<Esc>khy3ljlpjpjpjpjpjpjp<Esc>:3<CR>$hhhhh<C-V>jjjjjjyllllllphhhhh<C-V>jjjjjjy$pa6<Esc>ja8<Esc>ja10<Esc>ja12<Esc>ja14<Esc>ja16<Esc>ja18<Esc>:3<CR>#<Esc>:3<CR>$a 3*3=9<Esc>5blll<C-V>lyja <Esc>5p<Esc>up<Esc>j<Esc>kh3y<Esc>ja<Esc>p<Esc>ukl3yljpjpjpjpjp<Esc>:3<CR>jll<C-V>:9<CR><Esc>k:4<CR>ll<C-V>jjjjjy<C-V>ljjjjjy$pla12<Esc>ja15<Esc>ja18<Esc>ja21<Esc>ja24<Esc>ja27<Esc>:4<CR>$a 4*4=16<Esc>4hhh3yljpjpjpjpjp<Esc>:5<CR>3lh<C-V>ljjjjy$pla20<Esc>ja24<Esc>ja28<Esc>ja32<Esc>ja36<Esc>:5<CR>$a 5*5=25<Esc>4hhy2l<Esc>j<Esc>khy3ljpjpjpjp<Esc>kkk^ll<C-V>ljjjy$pla30<Esc>ja35<Esc>ja40<Esc>ja45<Esc>:6<CR>$a 6*6=36<Esc>5hh3yljpjpjp<Esc>:7<CR>ll<C-V>ljjy$p$a42<Esc>ja48<Esc>ja54<Esc>:8<CR>$a 7*<BS><BS><BS><Esc>ka &<BS>7*7 <BS>=49<Esc>5hh3yljpjp<Esc>:8<CR>ll<0xe2><0x88><0x9a>ljkh<C-V>ljy$p$a56<Esc>ja63<Esc>ka 8*8=64<Esc>ja *<BS>8*9 <BS>=72 (*(<BS><BS><BS>9*(<BS>9=81<Esc>:w<CR>:wq<CR>
@selawdivad: This is what happens if you don't know any fancy commands... =P
1 comment