ズンドコキヨシ with D

  • 2
    Like
  • 1
    Comment

元ネタを読んで一番最初に思いついたやり方です。

main.d
import std.stdio;
import std.random;

void main(){
    string[] words = ["ズン","ドコ"];
    int[] history = [];
    while(true){
        history ~= dice(1,1);
        words[history[$-1]].write();
        if (5 <= history.length) {
            if (history[$-5 .. $] == [0,0,0,0,1]){
                "キ・ヨ・シ!".writeln();
                return;
            }
        }
    }
}