Created
November 23, 2013 07:24
-
-
Save Getaji/7611852 to your computer and use it in GitHub Desktop.
半丁
0が半で1が丁。2以上の数字を入力すると終了。
乱数生成にはMT19937を使用。
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 std.stdio; | |
import std.conv; | |
import std.string; | |
import std.random; | |
int main(string[] argv) { | |
write("Han/Chou(0/1) ? > "); | |
int i; | |
while ((i = readln.chomp.to!int) < 2) | |
{ | |
Mt19937 gen; | |
gen.seed(unpredictableSeed); | |
int j = gen.front % 2; | |
write(j == 0 ? "Han! ": "Chou! "); | |
writeln(i == j ? "Yes!": "No..."); | |
write("Han/Chou(0/1) ? > "); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment