LoginSignup
4
4

More than 5 years have passed since last update.

ズンドコキヨシ with Vim script

Posted at

ズンドコって言ったら Vim script ですよね。(意味不明)

scriptencoding utf-8

let s:seed = 0
function! s:srand(seed) abort
  let s:seed = a:seed
endfunction

function! s:rand() abort
  let s:seed = s:seed * 214013 + 2531011
  return (s:seed < 0 ? s:seed - 0x80000000 : s:seed) / 0x10000 % 0x8000
endfunction

vnew
call s:srand(localtime())
while 1
  call append('$', ['ズン', 'ドコ'][s:rand()%2])
  if getline(line('$')-4, '$') == ['ズン', 'ズン', 'ズン', 'ズン', 'ドコ']
    call append('$', 'キ・ヨ・シ!')
    break
  endif
endwhile
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4