Skip to content

Instantly share code, notes, and snippets.

@youxkei
Last active August 22, 2016 02:14
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 youxkei/bd75020b35315e5e62c71546f98350c1 to your computer and use it in GitHub Desktop.
Save youxkei/bd75020b35315e5e62c71546f98350c1 to your computer and use it in GitHub Desktop.
import std.algorithm : map, each;
import std.conv : to;
import std.range : retro, zip, iota, cycle;
import std.array : array, join;
import std.functional : adjoin;
import std.stdio : writeln;
void main()
{
static immutable ERUTASO = ["えー", "びー", "しー", "でぃー", "いー", "えふ", "じー", "えいち", "あい", "じぇー", "けー", "える", "えむ", "えぬ", "おー", "ぴー", "きゅー", "あーる", "えす", "てぃー", "ゆー", "ぶい", "だぶりゅー", "えっくす", "わい", "ぜっと"];
static immutable N_LIST = ["", "一", "二", "三", "四", "五", "六", "七", "八", "九"];
static immutable N2_LIST = ["", "十", "百", "千"];
1000
.iota
.map!(n => n + 1)
.map!(n => n
.to!string
.adjoin!(
map!(c => c - '0'),
str => str.length.iota.retro
)
.field
.zip
.map!(elem =>
elem[0] == 0 ? "" :
elem[0] == 1 ?
elem[1] == 0 ? "一" :
N2_LIST[elem[1]] :
N_LIST[elem[0]] ~ N2_LIST[elem[1]]
)
.join
)
.zip(ERUTASO.cycle)
.map!(elem => elem[0] ~ "反田" ~ elem[1])
.each!(writeln);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment