Solve triangle solitaire puzzle: Difference between revisions
Content added Content deleted
(→{{header|Ruby}}: change of the termination condition) |
(Updated D entry) |
||
Line 29: | Line 29: | ||
string b2s(in int[] n) pure @safe { |
string b2s(in int[] n) pure @safe { |
||
static immutable fmt = |
static immutable fmt = 6.iota |
||
.map!(i => " ".replicate(5 - i) ~ "%d ".replicate(i)) |
.map!(i => " ".replicate(5 - i) ~ "%d ".replicate(i)) |
||
.join( |
.join('\n'); |
||
return fmt.format(n[0], n[1], n[2], n[3], n[4], n[5], n[6], |
return fmt.format(n[0], n[1], n[2], n[3], n[4], n[5], n[6], |
||
n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14]); |
n[7], n[8], n[9], n[10], n[11], n[12], n[13], n[14]); |