Nonoblock: Difference between revisions

Content added Content deleted
(Added Elixir)
(→‎{{header|Ruby}}: Rubyfy and simplify)
Line 776: Line 776:
else
else
rest = cell - blocks.inject(:+) - blocks.size + 2
rest = cell - blocks.inject(:+) - blocks.size + 2
bl, brest = blocks[0], blocks.drop(1)
bl, *brest = blocks
rest.times.inject(result) do |res, i|
rest.times.inject(result) do |res, i|
nblock(cell-i-bl-1, brest, position + '.'*i + '#'*bl + '.', res)
nblock(cell-i-bl-1, brest, position + '.'*i + '#'*bl + '.', res)
Line 859: Line 859:
else
else
rest = cell - blocks.inject(0,:+) - blocks.size + 2
rest = cell - blocks.inject(0,:+) - blocks.size + 2
bl, brest = blocks[0], blocks.drop(1)
bl, *brest = blocks
rest.times do |i|
rest.times do |i|
nonoblocks(cell-i-bl-1, brest, position + '.'*i + '#'*bl + '.')
nonoblocks(cell-i-bl-1, brest, position + '.'*i + '#'*bl + '.')