module nbottles ; import std.string ; import std.stdio ; alias Exception NoMoreBottlesLeft ; enum { // role None = 0x0, // normal for OP and Term Taker = 0x1, // for OP that minus one bottlesLeft Viewer = 0x2, // for Term display bottlesLeft NewLine = 0x4, // for Term that sending a newline to IO } class XP { static string[] ones = ["","one","two","three","four", "five","six","seven","eight","nine"] ; static string[] tens = ["", "ten", "twenty","thirty","fourty", "fifty","sixty","seventy","eighty","ninty"] ; static string[] teens = ["","eleven","twelve","thirteen","fourteen", "fifteen","sixteen","seventeen","eighteen","nineteen"] ; static private int bottlesLeft = 99 ; static bool opCall() { if (bottlesLeft == 0) throw new NoMoreBottlesLeft("") ; return true ; } static string Cap(string s) { return toupper(s[0..1]) ~ s[1..$] ; } static string num2word(int i) { if (i == 0) return "No more" ; //return std.string.toString(i) ; string[2] digits ; int numTen = i / 10 ; int numOne = i