Skip to content

Instantly share code, notes, and snippets.

@Getaji
Created November 23, 2013 07:24
Show Gist options
  • Save Getaji/7611852 to your computer and use it in GitHub Desktop.
Save Getaji/7611852 to your computer and use it in GitHub Desktop.
半丁 0が半で1が丁。2以上の数字を入力すると終了。 乱数生成にはMT19937を使用。
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