-
-
Save ningbit/0d6e819188f94b9dec52 to your computer and use it in GitHub Desktop.
decodernorange.rb
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
code = "fx1=ZY&iX3=ZW&hm5=ZU&dg7=ZS&ei9=ZQ&ge11=ZO&tr13=ZM&hh15=ZK&uX17=ZI&si19=ZG&tX21=ZE&Xn23=ZC&hp25=ZA&pX27=YY&dl29=YW&wo31=YU&XX33=YS&XX35=YQ&re37=YO&et39=YM&ia41=YK&wn43=YI&uo45=YG&dX47=YE&so49=YC&ec51=YA&do53=XY&sX55=XW&xr57=XU&so59=XS&aX61=XQ&ph63=XO&ni65=XM&nX67=XK&Xa69=XI&yX71=XG&aX73=XE&ei75=XC&ie0=ZZ&Xa2=ZX&Xy4=ZV&aX6=ZT&Xn8=ZR&in10=ZP&hp12=ZN&Xa14=ZL&os16=ZJ&rx18=ZH&Xs20=ZF&od22=ZD&ce24=ZB&os26=YZ&Xd28=YX&ou30=YV&nw32=YT&ai34=YR&te36=YP&er38=YN&XX40=YL&XX42=YJ&ow44=YH&ld46=YF&Xp48=YD&ph50=YB&nX52=XZ&Xt54=XX&is56=XV&Xu58=XT&hh60=XR&rt62=XP&eg64=XN&ie66=XL&gd68=XJ&mh70=XH&Xi72=XF&xf74=XD" | |
ncode = code.split("&") | |
rcode = [] | |
ncode.each_with_index do |string, index| | |
rcode[index] = [string.split("=")[0],index] | |
end | |
rcode.each_with_index do |array, index| | |
rcode[index][1] = array[0][2,2].to_i | |
rcode[index][0] = array[0][0,2] | |
end | |
rcode.sort_by! {|val1, val2| val2} | |
oddString="" | |
evenString="" | |
rcode.each do |val1, val2| | |
oddString += val1[0].gsub("X"," ") | |
evenString += val1[1].gsub("X"," ") | |
end | |
puts oddString | |
puts evenString.reverse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment