Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # generate 10 ttt with rand Xs & Os
- takeaway
- 1. for the space in between each ttt, puts (outside the loop, not inside the loop)
- ```ruby
- def gen_ttt
- a = ("X"*4 + "O"*5 ).split(//)
- b = Array.new(3){Array.new(a.sample(3))}
- ttt =
- for i in 1..10
- b.each do |row|
- p row
- end
- puts # instead p "\n" for space
- end
- return ttt
- end
- puts gen_ttt
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement