Skip to content

Instantly share code, notes, and snippets.

@martin2110
Created September 24, 2015 18:19
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/1953f83f4f49f03cabe4 to your computer and use it in GitHub Desktop.
Save martin2110/1953f83f4f49f03cabe4 to your computer and use it in GitHub Desktop.
@direction = Hash.new('Unknown')
(351..360).each {|n| @direction[n] = "North" }
(0..10).each {|n| @direction[n] = "North" }
(11..30).each {|n| @direction[n] = "North North East" }
(31..60).each {|n| @direction[n] = "North East" }
(61..80).each {|n| @direction[n] = "East North East" }
(81..100).each {|n| @direction[n] = "East" }
(101..120).each {|n| @direction[n] = "East South East" }
(121..150).each {|n| @direction[n] = "South East" }
(151..170).each {|n| @direction[n] = "South South East " }
(171..190).each {|n| @direction[n] = "South" }
(191..210).each {|n| @direction[n] = "South South West" }
(211..240).each {|n| @direction[n] = "South West" }
(241..260).each {|n| @direction[n] = "West South West" }
(261..280).each {|n| @direction[n] = "West" }
(281..300).each {|n| @direction[n] = "West North West" }
(301..330).each {|n| @direction[n] = "North West"}
(331..350).each {|n| @direction[n] = "North North West"}
def wind_direction(deg)
@direction[deg]
end
puts wind_direction(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment