# Rでズンドコ

• 3
いいね
• 0
コメント
に更新
3
この記事は最終更新日から1年以上が経過しています。

# こういうのをPythonでも書きたいだけの人生だった

zun.R
```(function(a,b){if(b==5){c(a,'キ・ヨ・シ！')}else if(rbinom(1,1,0.5)>0){Recall(c(a,'ズン'),b-1)}else{Recall(c(a,'ドコ'),4+(b<=0)*1)}})('',4)
```

JavaScriptでも同じようにかけるけど、ちょっと長くなる。

```Rscript zun.R
[1] ""             "ズン"         "ズン"         "ズン"         "ドコ"
[6] "ドコ"         "ズン"         "ドコ"         "ドコ"         "ズン"
[11] "ドコ"         "ズン"         "ズン"         "ドコ"         "ドコ"
[16] "ドコ"         "ズン"         "ドコ"         "ドコ"         "ズン"
[21] "ドコ"         "ドコ"         "ズン"         "ドコ"         "ドコ"
[26] "ドコ"         "ズン"         "ドコ"         "ズン"         "ズン"
[31] "ドコ"         "ドコ"         "ドコ"         "ズン"         "ドコ"
[36] "ズン"         "ズン"         "ズン"         "ドコ"         "ズン"
[41] "ドコ"         "ドコ"         "ドコ"         "ドコ"         "ズン"
[46] "ズン"         "ズン"         "ドコ"         "ドコ"         "ドコ"
[51] "ドコ"         "ドコ"         "ドコ"         "ドコ"         "ズン"
[56] "ドコ"         "ドコ"         "ドコ"         "ズン"         "ズン"
[61] "ズン"         "ズン"         "ズン"         "ズン"         "ズン"
[66] "ズン"         "ズン"         "ズン"         "ズン"         "ドコ"
[71] "キ・ヨ・シ！"
```