On 12/10/05, Michael Fellinger <m.fellinger / gmail.com> wrote:
> i see.. it wasn't clear at first what the kind of data is that is the input
> for the program.
> However, after testing my little suggestion, i found that there are is a bug
> in it - it didn't strip the \n from the line it gets. also i made the
> iteration independent from the size of the board and made the output each
> line a bit prettier ^^

if you use a range, you don't need to worry about extraneous input
(such as the \n)

def make_board
 board = []
 puts "input rows, seperated by spaces:"
 9.times { board << gets.split(//)[0..8].map { |e| e.to_i } }
 return board
end

puts make_board.map { |r| r.join(" ") }.join("\n")