Created
December 3, 2019 15:15
-
-
Save YujiSoftware/f8915e2e7532359eaae07a2cd5f15996 to your computer and use it in GitHub Desktop.
ズンドコキヨシ (Java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public enum Kiyoshi { | |
ズン, ドコ; | |
private static final Kiyoshi[] answer = new Kiyoshi[] { ズン, ズン, ズン, ズン, ドコ }; | |
public static void main(String[] args) { | |
Random random = new Random(); | |
int index = 0; | |
do { | |
Kiyoshi current = random.nextBoolean() ? ズン : ドコ; | |
System.out.append(current.name()).append(' ').flush(); | |
if (current == answer[index]) { | |
index++; | |
} else { | |
index = 0; | |
System.out.println(); | |
} | |
} while (index < answer.length); | |
System.out.println("キ・ヨ・シ!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment