Skip to content

Instantly share code, notes, and snippets.

@TrevorHinesley
Created October 6, 2015 19:27
Show Gist options
  • Select an option

  • Save TrevorHinesley/63734256dd2b42c8ad91 to your computer and use it in GitHub Desktop.

Select an option

Save TrevorHinesley/63734256dd2b42c8ad91 to your computer and use it in GitHub Desktop.
helmet math
def helmet_distance_from_the_left team, index
width_of_largest_sideline = 850
midfield = width_of_largest_sideline / 2
helmet_starting_line_offset = index*3.8
distance_from_far_left_edge_to_one_yard_line = 130
distance_from_left = distance_from_far_left_edge_to_one_yard_line +
((team.num_of_hashtag_shares / team.offset) / days_until_campaign_ends)
if distance_from_left >= midfield
distance_from_midfield_to_current_position = distance_from_left - midfield
divisor = midfield / distance_from_midfield_to_current_position
else
distance_from_midfield_to_current_position = midfield - distance_from_left
divisor = midfield / distance_from_midfield_to_current_position
end
helmet_starting_line_offset = helmet_starting_line_offset / divisor
distance_from_left + helmet_starting_line_offset
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment