Last active
September 24, 2015 17:49
-
-
Save martin2110/ba51d166d4aec82cb6da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(351..360).each {|n| HASH[n] = :north }