Z
zimba-tm
Hello ruby fellows,
Maybe you can help me.
I'm currently trying to make a Sudoku solver for my first ruby program.
Sudoku is a nice 9x9 board game with simple rules, but it can be tough
to solve. More infos at http://www.sudoku.com/ if you want to launch a
RubyQuizz
What I would do, is use a kind of 2D Matrix that would represent the
board but couldn't find a satisfying method.
This is my current implementation using arrays :=20
----
board =3D Array.new
=20
(1..9).each do |row_num|
board[row_num] =3D Array.new
(1..9).each do |col_num|
board[row_num][col_num] =3D "X"
end
end
----
If I "puts board", I'd like to have a 2D view instead.
How does puts work, does it call the to_str method ?
Also, I'd like to access the console as a 2D Array too,
so that I can write on screen directly like a text-framebuffer.
I have so many questions..
/me is refraining to flood ruby-talk
--=20
Cheers,
zimba
http://zimba.oree.ch
Maybe you can help me.
I'm currently trying to make a Sudoku solver for my first ruby program.
Sudoku is a nice 9x9 board game with simple rules, but it can be tough
to solve. More infos at http://www.sudoku.com/ if you want to launch a
RubyQuizz
What I would do, is use a kind of 2D Matrix that would represent the
board but couldn't find a satisfying method.
This is my current implementation using arrays :=20
----
board =3D Array.new
=20
(1..9).each do |row_num|
board[row_num] =3D Array.new
(1..9).each do |col_num|
board[row_num][col_num] =3D "X"
end
end
----
If I "puts board", I'd like to have a 2D view instead.
How does puts work, does it call the to_str method ?
Also, I'd like to access the console as a 2D Array too,
so that I can write on screen directly like a text-framebuffer.
I have so many questions..
/me is refraining to flood ruby-talk
--=20
Cheers,
zimba
http://zimba.oree.ch