examples/queens.rb
# n, if provided, is the size of the full board.  This allows this routine
# to show a partly-filled board by passing n > board.size, though we don't
# currently use this.
n, if provided, is the size of the full board.  This allows this routine
to show a partly-filled board by passing n > board.size, though we don't
currently use this.
n if provided is the size of the full board . This allows this routine to show a partly - filled board by passing n > board . size though we don ' t currently use this .
def board_to_s board, n = board.size
  b = empty_board n
  board.each_with_index do |x, i|
    b[i][x-1] = 'Q'
  end
  b.join "\n"
end
def board_to_s board , n = board . size b = empty_board n board . each_with_index do | x , i | b [ i ] [ x - 1 ] = 'Q' end b . join "\n" end
n, if provided, is the size of the full board.
n if provided is the size of the full board .
board
<not_specific>
n
<not_specific>
size
<not_specific>