lib/tak/board.rb
# Gets the current visible flat counts on the board
#
# @return [Hash[Symbol, Integer]]
Gets the current visible flat counts on the board
Gets the current visible flat counts on the board
def flat_counts
      count_hash = Hash.new { |h,k| h[k] = 0 }
      @board.each_with_object(count_hash) do |row, counts|
        row.each do |cell|
          counts[:white] += 1 if cell.last == 'w'
          counts[:black] += 1 if cell.last == 'b'
        end
      end
    end
def flat_counts count_hash = Hash . new { | h , k | h [ k ] = 0 } @board . each_with_object ( count_hash ) do | row , counts | row . each do | cell | counts [ :white ] += 1 if cell . last == 'w' counts [ :black ] += 1 if cell . last == 'b' end end end
Gets the current visible flat counts on the board
Gets the current visible flat counts on the board
None
Hash[Symbol, Integer