Commits

Tuk Bredsdorff  committed bd3a1b1 Draft

Calculating total length as well.

  • Participants
  • Parent commits 0573986

Comments (0)

Files changed (1)

File geodome_frame.rb

 		# Return the radius as a Length
 		return radius.to_l
 	end
-	
+
 	# Print an overview of the struts
 	def self.print_strut_lengths
+		total_length = 0.0
+		
 		strut_info = self.find_strut_lengths
 		strut_lengths_sorted = strut_info.keys.sort
 		radius = self.dome_radius
 		
 		strut_lengths_sorted.each_with_index do | length_rounded, index |
 			count = strut_info[length_rounded]['count']
-			length = strut_info[length_rounded]['length'].to_s
+			length = strut_info[length_rounded]['length']
 			name = STRUT_NAMES[index]
 			color = PRIMARY_COLORS[index]
-			puts "#{count} x #{name} (#{color}): #{length}"
+			total_length += count * length
+			puts "#{count} x #{name} (#{color}): #{length.to_s}"
 		end
+		
+		puts "Total length: #{total_length.to_l.to_s}"
 	end
 
 	def self.main