ビンゴの結果を整形表示
Posted feedbacks - Smalltalk
Squeak Smalltalk で。
1 2 3 4 5 6 7 8 9 10 11 12 | | n size bingo streams |
n := 35.
size := n printString size + 1.
bingo := (1 to: n) asArray shuffled readStream.
streams := {String new writeStream. String new writeStream}.
World findATranscript: nil.
1 to: n do: [:idx |
{idx. bingo next} with: streams do: [:int :strm |
strm nextPutAll: (int printPaddedWith: $ to: size)].
((idx isDivisibleBy: 10) or: [idx = n]) ifTrue: [
Transcript cr.
streams do: [:strm | Transcript cr; show: strm contents. strm reset]]]
|


raynstard
#3403()
Rating1/1=1.00
「重複無し乱数」で作ったbingo関数の結果を下のように「何番目の乱数か」とセットにして10個ずつ折り返して表示するコードを書いてください。
[ reply ]