Comment detail

ビンゴの結果を整形表示 (Nested Flatten)
enumeratorで
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
def bingo(num)
	(1..num).to_a.sort_by{ rand }
end

require 'enumerator'
bingo(35).enum_slice(10).each_with_index{ |e,index|
	num=index * 10 + 1
	tmpl=(["%02s"] * e.size).join(' ')

	puts tmpl % (num .. num + e.size).to_a
	puts tmpl % e
	puts ""
}

Index

Feed

Other

Link

Pathtraq

loading...