Help us understand the problem. What is going on with this article?

Rでズンドコ

More than 3 years have passed since last update.

こういうのを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] "キ・ヨ・シ!"

妥協したPython版

sasanquaneuf
座敷わらしになれる日を夢見て日々過ごしている一児の父です。 画像は「R」的なアレにインスパイアされて手書きで書いた「いぬ」です。 中学生の頃はVBなど。大学生の頃はC++ / Haskell / mathematica など。SIer時代はQlik Sense / R / C# / Java / PHP / JavaScript など。 最近は Python / TypeScript など。
https://qiitadon.com/@sasanquaneuf
uniaim
心と歴史を動かす。Tabレジ、Event Manager+、Point Manager、PREORDER、CASHIER等のサービス提供と、端末レンタル・イベント運営などを行っています。
https://uniaim.co.jp
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした