Last active
August 29, 2015 14:21
-
-
Save satour/f2978e10ef0ddf307c15 to your computer and use it in GitHub Desktop.
COMPARE POINTS - CodeEval
This file contains 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
#https://www.codeeval.com/open_challenges/192/ | |
File.open(ARGV[0]).each_line do |line| | |
x, y, q, r = line.split(/ /).map(&:to_i) | |
operation = "" | |
operation += "N" if (r-y) > 0 | |
operation += "S" if (r-y) < 0 | |
operation += "E" if (q-x) > 0 | |
operation += "W" if (q-x) < 0 | |
operation = "here" if operation == "" | |
puts operation | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment