LoginSignup
5
4

More than 5 years have passed since last update.

ズンドコ with 日本語Java

Last updated at Posted at 2016-03-11

流行ってるみたいなので作ってみた.
日本語使えるよ,っていうのをメインに.
てか,ルール合ってるのかな.

Kiyoshi.java
public class Kiyoshi {
    enum ズンドコ {
        ズン,
        ドコ
    }

    public static final String キヨシ = "キ・ヨ・シ!";

    public static void main(String[] args) {
        Random rand = new Random();
        int z = 0;
        while(true){
            ズンドコ zd = ズンドコ.values()[rand.nextInt(2)];
            System.out.print(zd.name());
            switch (zd){
                case ズン:
                    z++;
                    break;
                case ドコ:
                    if(z>4){
                        System.out.println(キヨシ);
                        return;
                    }
                    z = 0;
            }
        }
    }
}

変更
最後のキヨシメッセージが違っていたので訂正.
ちなみにキヨシだけStringにしているのは,!を変数に使うのがちょっと気持ち悪かったからです.

5
4
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
5
4