lib/chess/board.rb
# Returns an 8x8 array filled with the default chess board pieces and
# nil if the square is empty
Returns an 8x8 array filled with the default chess board pieces and
nil if the square is empty
Returns an 8x8 array filled with the default chess board pieces and nil if the square is empty
def new_board
      board = []
      8.times do |row|
        board << case row
        when 0
          add_back_row("white", row)
        when 1
          add_pawn_row("white", row)
        when 6
          add_pawn_row("black", row)
        when 7
          add_back_row("black", row)
        else
          Array.new(8)
        end
      end 
      board
    end
def new_board board = [ ] 8 . times do | row | board << case row when 0 add_back_row ( "white" , row ) when 1 add_pawn_row ( "white" , row ) when 6 add_pawn_row ( "black" , row ) when 7 add_back_row ( "black" , row ) else Array . new ( 8 ) end end board end
Returns an 8x8 array filled with the default chess board pieces and
nil if the square is empty
Returns an 8x8 array filled with the default chess board pieces and nil if the square is empty