LoginSignup
4
4

More than 5 years have passed since last update.

「進捗・どう・です・か」をVim scriptで

Last updated at Posted at 2015-10-22

「進捗・どう・です・か」をPerlで

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

function! s:shinchoku_dou_desu_ka() abort
  let words = ['進捗', 'どう', 'です', 'か']
  let pat = join(words, '')
  let buf = ''
  call s:srand(localtime())
  while 1
    let buf .= words[s:rand() % len(words)]
    if buf[-len(pat) :] == pat
      echo buf
      echo len(split(buf, '\zs')) . '文字で煽られました。'
      break
    endif
  endwhile
endfunction

call s:shinchoku_dou_desu_ka()
出力
どうどうですか進捗進捗どうです進捗進捗かかどうかかですかです進捗かかかです進捗どう進捗か進捗かです進捗か進捗ですですか進捗かどうですか進捗どうどうどうか進捗進捗どうですどうかどう進捗ですどう進捗進捗進捗ですどうですどうですかですです進捗ですどうです進捗どうどうかどう進捗進捗進捗です進捗進捗かか進捗ですかかです進捗どうかかかですどうかどう進捗ですどうかです進捗ですですどうどうですか進捗進捗かどうですどうどうですかかか進捗進捗か進捗どうか進捗進捗どうかどうどう進捗かですどう進捗どうかどうか進捗どうかかですかかどう進捗進捗かどうかどうどうどうどうですどう進捗です進捗か進捗かですですどう進捗進捗です進捗どうか進捗どうかですか進捗進捗進捗進捗ですどうかどうですです進捗かどうか進捗か進捗どうかですかですかかかどう進捗どう進捗ですどう進捗かですどうどうかどうかどう進捗かですどうどうどうどう進捗か進捗かどうですかです進捗かですどうですですどうですか進捗どう進捗進捗どうどうですどう進捗どう進捗進捗か進捗かかどうです進捗ですどう進捗かどう進捗ですです進捗ですどうか進捗どうかどうどうか進捗進捗進捗どうかです進捗か進捗ですかですですかです進捗か進捗どうかかですか進捗かどうですどうか進捗どうどうです進捗かか進捗進捗進捗ですどうですどうか進捗か進捗かですか進捗か進捗かですどうどう進捗どうどうどうどう進捗かか進捗どうかですどう進捗ですかです進捗か進捗ですどうかか進捗か進捗進捗かです進捗どう進捗か進捗どうかどうですかですか進捗進捗ですどうですですかどうかですですどうか進捗どうですか???
686文字で煽られました。

そして、進捗はかなり芳しくない。

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