2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PowerShellの手習いにズンドコキヨシ作ってみた

Posted at

習いたてのPowerShellの習作でズンドコキヨシ作ってみた。かなり初心者っぽい簡素な書き方だと思う。

<# 
「ズン」「ドコ」のいずれかをランダムで出力し続けて
「ズン」「ズン」「ズン」「ズン」「ドコ」の配列が出たら
「キ・ヨ・シ!」って出力した後終了って関数作った
https://twitter.com/kumiromilk/status/707437861881180160
----
PowerShellの手習いにズンドコキヨシ作ってみた
#>

Get-ZunDoko

function Get-ZunDoko {
    $words = @("ズン","ドコ");
    $tail = "";
    Do {
        $word = Get-Random -InputObject $words
        $word
        $tail += $word
        if ($tail.Length -gt 10) {
            $tail = $tail.Substring($tail.Length - 10, 10)
        }
    } while ($tail -ne "ズンズンズンズンドコ")
    "キ・ヨ・シ!"
}

ワンライナー版だとか他言語版だとかもっと変態チックなのとかは「ズンドコキヨシまとめ - Qiita」あたりで探してください。

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?