Skip to content

Instantly share code, notes, and snippets.

@Chirimen-Jako
Created August 21, 2019 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chirimen-Jako/8eeb198db98b2f35d7951cf81e1ec455 to your computer and use it in GitHub Desktop.
Save Chirimen-Jako/8eeb198db98b2f35d7951cf81e1ec455 to your computer and use it in GitHub Desktop.
おっぱいそんちくびんびん♪ (D)
/*
おっぱい.d
2019/08/21: initial release
Ubuntu 18.04.2 LTS (Bionic Beaver)
DMD64 D Compiler v2.087.1
Microsoft Windows 10 Version 1903 (OS build 18362.295)
DMD32 D Compiler v2.087.1
Note1: You have to change source name to oppai.d.
Note2: You have to chcp 65001 (utf-8) on cmd.exe and PowerShell.
Dedicated to shirasu
https://gist.github.com/8q/a5331c6ef8a205b32125
*/
import std.algorithm : map;
import std.array : join;
import std.random : unpredictableSeed, Random, randomShuffle;
import std.stdio : write, writeln, writefln;
void main(string[] args)
{
const string RealStr = "おっぱいそんちくびんびん";
const string[] OppaiElements = ["おっ", "ぱい", "そん", "ちく", "びん", "びん"];
auto rng = Random(unpredictableSeed());
auto testStr = "";
auto count = 0;
do {
++count;
auto numList = [0, 1, 2, 3, 4, 5].randomShuffle(rng);
testStr = numList.map!(n => (OppaiElements[n])).join();
writefln("%d %s", count, testStr);
} while (testStr != RealStr);
write("おめでとうございます!\x20");
writefln("あなたは%d回目に%sしました。", count, RealStr);
writeln("end");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment