M
Maarten Mortier
I have:
class Sudoku
def[](r,c)
@rows[r][c]
end
def set(r,c,a)
@rows[r][c]=a
end
end
Now, how can I define a []= operator instead of the awkward set(r,c,a) ?
I want to be able to do
sudoku[2,3]=candidate
or even
sudoku[2][3] = candidate
and
sudoku[3] = row
Are these things possible? How, I could not find the information.
(I'm just learning, for educational reasons I don't want to extend the
Matrix class)
class Sudoku
def[](r,c)
@rows[r][c]
end
def set(r,c,a)
@rows[r][c]=a
end
end
Now, how can I define a []= operator instead of the awkward set(r,c,a) ?
I want to be able to do
sudoku[2,3]=candidate
or even
sudoku[2][3] = candidate
and
sudoku[3] = row
Are these things possible? How, I could not find the information.
(I'm just learning, for educational reasons I don't want to extend the
Matrix class)