Skip to content

Instantly share code, notes, and snippets.

@YujiSoftware
Created December 3, 2019 15:15
Show Gist options
  • Save YujiSoftware/f8915e2e7532359eaae07a2cd5f15996 to your computer and use it in GitHub Desktop.
Save YujiSoftware/f8915e2e7532359eaae07a2cd5f15996 to your computer and use it in GitHub Desktop.
ズンドコキヨシ (Java)
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