# File wm.rb, line 500 def diamond! if (numClients = num_grounded_clients) > 0 subtriArea = numClients / 2 crestArea = numClients % subtriArea # build fist sub-triangle upwards height = area = 0 lastCol = nil each_column do |col| if area < subtriArea height += 1 col.length = height area += height col.mode = :default lastCol = col else break end end # build crest of overall triangle if crestArea > 0 lastCol.length = height + crestArea end # build second sub-triangle downwards each_column(lastCol.index + 1) do |col| if area > 0 col.length = height area -= height height -= 1 else break end end end end