ズンドコキヨシ
The ズンドコキヨシ (Zundoko Kiyoshi) function, also known as キヨシチェック (Kiyoshi check) or ズンドコチェック (Zundoko check), is a meme that originates from a tweet by てくも (@kumiromilk) (Tekumo) on March 9, 2016.
Origin
The function originates from this tweet[1]:
- I had a problem "implement and describe your own function" on the examine of lecture of Java, Then I implemented the function to keep outputting either "zun" or "doko" randomly and the sequence of "zun" "zun" "zun" "zun" and "doko" outputs "Ki-yo-shi!" and terminates. Then I got 100% grade and earned a unit.
- —てくも (@kumiromilk), March 9, 2016
The name of the function comes from lyrics of the song きよしのズンドコ節 (Kiyoshi no Zundoko Bushi) sung by Kiyoshi Hikawa and fans' cheering when he sings the song.
Spreading
The tweet made many people post the implementation of the function in several programming languages, such as Ruby, Python, Go, and so on[2].
Variations
The original tweet used three strings to output: "ズン", "ドコ", "キ・ヨ・シ!" in Katakana. Some outputs Romanization of those: "Zun", "Doko", "Kiyoshi!".
Some programming languages have no randomization commands, such as brainfuck, The implementation in the language requires a seed value from input from standard input for PRNG implemented in the function, for example[3].
Implementations
The following Python script defines the function ズンドコキヨシ().
def ズンドコキヨシ(): List = [] import random while True: if random.randint(0, 1) == 0: List.append("ズン") else: List.append("ドコ") print(List[len(List)-1]) sublist = ["ズン","ズン","ズン","ズン","ドコ"] for idx in range(len(List) - len(sublist) + 1): if List[idx: idx + len(sublist)] == sublist: res = True List.append("キ・ヨ・シ!") print("キ・ヨ・シ!") break if List[len(List)-1] == "キ・ヨ・シ!": break
References
- ↑ Original tweet by てくも @kumiromilk. The original tweet was:
- Javaの講義、試験が「自作関数を作り記述しなさい」って問題だったから
- 「ズン」「ドコ」のいずれかをランダムで出力し続けて「ズン」「ズン」「ズン」「ズン」「ドコ」の配列が出たら「キ・ヨ・シ!」って出力した後終了って関数作ったら満点で単位貰ってた
- ↑ ズンドコキヨシまとめ—The article to summarize the implementation of "ズンドコキヨシ" program. @shunsugai@github. Last edit: 2016-06-26.
- ↑ ズンドコキヨシ with Brainf**k. @angel_p_57. Last edit: 2016-03-17.