Skip to content

Instantly share code, notes, and snippets.

@martin2110
Last active September 24, 2015 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martin2110/ba51d166d4aec82cb6da to your computer and use it in GitHub Desktop.
Save martin2110/ba51d166d4aec82cb6da to your computer and use it in GitHub Desktop.
DIRECTION = {
north: (351..360).to_a + (0..10).to_a,
north_north_east: (11..30).to_a,
north_east: (31..60).to_a,
east_north_east: (61..80).to_a,
east: (81..100).to_a,
east_south_east: (101..120).to_a,
south_east: (121..150).to_a,
south_south_east: (151..170).to_a,
south: (171..190).to_a,
south_south_west: (191..210).to_a,
south_west: (211..240).to_a,
west_south_west: (241..260).to_a,
west: (261..280).to_a,
west_north_west: (281..300).to_a,
north_west: (301..330).to_a,
north_north_west: (331..350).to_a
}
def wind_direction(deg)
DIRECTION.keys.select{|k| DIRECTION[k].include?(deg)}
end
deg = 1
puts wind_direction(deg)
@tjsingleton
Copy link

(351..360).each {|n| HASH[n] = :north }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment