いろんな言語でズンドコキヨシ書いたので載せておきます
(ズンズンズンズンズンドコはスルーする方針で~(ドコ)ズンズンズンズンドコキ・ヨ・シ!にします)

元ネタ

ソース

C#

using System;
using System.Collections.Generic;
using System.Linq;

namespace CCharp {
    class ZunDokoKiyoshi {
        static IEnumerable<string> Zundoko() {
            var random = new Random();
            while(true)
                yield return random.Next(2) == 1 ? "ズン" : "ドコ";
        }

        static void Main(string[] args) {
            int count = 0;
            foreach(var s in Zundoko().Select(x => { Console.Out.WriteLine(x); return x; })) {
                switch(count) {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                        {
                            if(s == "ズン")
                                count++;
                            else
                                count = 0;
                            break;
                        }
                    default:
                        {
                            if(s == "ドコ") {
                                Console.Out.WriteLine("キ・ヨ・シ!");
                                goto end;
                            } else
                                count = 0;
                            break;
                        }
                }
            }
            end:
            { }
        }
    }
}

F#

let zundoko =
    let random = new System.Random()
    seq{while true do if random.Next(2)=0 then yield "ズン" else yield "ドコ" }
    
[<EntryPoint>]
let main argv = 
    let enum = zundoko.GetEnumerator()
    let rec kiyoshi count = 
        enum.MoveNext() |> ignore
        let s = enum.Current
        printfn "%s" s
        if count<4 then 
            if s="ズン" then 
                kiyoshi(count+1)              
            else
                kiyoshi(0)           
        else
            if s="ドコ" then
                printfn "キ・ヨ・シ!"
            else
                kiyoshi(0)
    kiyoshi(0)
    0

VB.NET

Imports System

Module ZunDokoKiyoshi

    Iterator Function Zundoko() As IEnumerable(Of String)
        Dim random As New Random()
        While True
            Yield IIf(random.Next(2) = 0, "ズン", "ドコ")
        End While

    End Function

    Sub Main()
        Dim count = 0
        For Each s In Zundoko()
            Console.Out.WriteLine(s)
            If count < 4 Then
                If s = "ズン" Then
                    count = count + 1
                Else
                    count = 0
                End If
            Else
                If s = "ドコ" Then
                    Console.Out.WriteLine("キ・ヨ・シ!")
                    GoTo endLoop
                Else
                    count = 0
                End If
            End If
        Next
endLoop:
    End Sub

End Module

C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

void main() {
    printf("c\n");
    srand((unsigned)time(NULL));
    int count = 0;
    while (1) {
        char* s = rand() % 2 == 0 ? "ズン" : "ドコ";
        printf("%s\n", s);
        switch (count) {
        case 0:
        case 1:
        case 2:
        case 3: {
            if (strcmp(s, "ズン") == 0) count++; else count = 0;
            break;
        }
        default: {
            if (strcmp(s, "ドコ") == 0) {
                printf("キ・ヨ・シ!\n");
                goto end;
            }
            else count = 0;
            break;
        }

        }
    }
end: {}
}

C++

using namespace std;
#include <iostream>
#include <string>
#include <random>
#include <ctime>

void main() {
    mt19937 mt(static_cast<unsigned int>(time(nullptr)));
    uniform_int_distribution<int> rand2(0, 1);
    int count = 0;
    while (true) {
        string s = rand2(mt) == 0 ? "ズン" : "ドコ";
        cout << s << endl;
        switch (count) {
        case 0:
        case 1:
        case 2:
        case 3: {
            if (s == "ズン") count++; else count = 0;
            break;
        }
        default: {
            if (s == "ドコ") {
                cout << "キ・ヨ・シ!" << endl;
                goto end;
            }
            else count = 0;
            break;
        }
        }
    }
end: {}
}

JavaScript

<html>
  <head>
    <title>ズンドコキヨシ</title>
  </head>
  <body>
    <input type="button" value="ズンドコ" onclick="main()">
    <div id="zundoko" />
  </body>
</html>

<script>
function main(){
  var view = document.getElementById("zundoko");
  view.innerText="";
  var zundoko = ["ズン","ドコ"];
  var count = 0;
  while(true){
    var s = zundoko[Math.floor(Math.random()*zundoko.length)]
    view.innerText+=s+"\n";
    if(count<4){
      if(s=="ズン")count++; else count=0;
    }else{
      if(s=="ドコ"){
        view.innerText+="キ・ヨ・シ!\n";
        break;
      }else count=0;
    }
  }
}
</script>

Java

import java.util.Random;

public class ZunDokoKiyoshi {
    public static void main(String[] args) {
        Random random = new Random();
        int count = 0;
        loop:
        while (true) {
            String s = new String[]{"ズン", "ドコ"}[random.nextInt(2)];
            System.out.println(s);
            switch (count) {
                case 0:
                case 1:
                case 2:
                case 3: {
                    if (s.equals("ズン")) count++;
                    else count = 0;
                    break;
                }
                default: {
                    if (s.equals("ドコ")) {
                        System.out.println("キ・ヨ・シ!");
                        break loop;
                    } else count = 0;
                }
            }
        }
    }
}

Kotlin

import java.util.*

fun zundoko(): Sequence<String> {
    val random = Random()
    return generateSequence { arrayOf("ズン", "ドコ")[random.nextInt(2)] }
}

fun main(args: Array<String>) {
    var count = 0
    loop@for (s in zundoko().map { println(it); it }) {
        when (count) {
            0, 1, 2, 3 -> if (s == "ズン") count++ else count = 0
            else -> if (s == "ドコ") {
                println("キ・ヨ・シ!")
                break@loop
            } else {
                count = 0
            }
        }
    }
}