Skip to content

Instantly share code, notes, and snippets.

@ticktricktrack
Created August 23, 2017 15: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 ticktricktrack/794ce9531de2fe5417705132d2a27c02 to your computer and use it in GitHub Desktop.
Save ticktricktrack/794ce9531de2fe5417705132d2a27c02 to your computer and use it in GitHub Desktop.
Animalize
class Animalize
attr_reader :easting, :northing
def initialize(easting, northing)
@easting = easting
@northing = northing
end
HORSE = [[59, 338], [63, 350], [105, 376], [105, 347], [93, 347], [80, 335], [76, 330], [76, 330], [70, 289], [73, 282], [97, 277], [146, 263], [171, 296], [171, 296], [212, 379], [213, 385], [211, 393], [193, 422], [225, 422], [230, 401], [238, 389], [230, 369], [230, 369], [223, 344], [218, 323], [205, 262], [312, 258], [329, 318], [319, 347], [284, 395], [268, 422], [302, 423], [303, 410], [304, 406], [313, 396], [327, 370], [364, 333], [364, 333], [369, 323], [365, 300], [382, 263], [406, 288], [437, 314], [437, 314], [444, 321], [456, 343], [469, 386], [466, 399], [466, 399], [454, 422], [485, 422], [485, 408], [486, 405], [486, 405], [493, 392], [474, 328], [474, 328], [472, 305], [469, 295], [458, 281], [444, 246], [441, 187], [419, 144], [461, 256], [461, 263], [502, 263], [411, 135], [352, 121], [219, 130], [72, 40], [45, 44], [3, 41], [25, 59], [26, 114], [29, 161], [51, 176], [65, 170], [69, 156], [78, 120], [90, 114], [104, 159], [104, 201], [104, 201], [113, 231], [60, 248], [40, 262], [40, 262], [39, 275], [59, 338]]
CAT = [[85, 191], [ 74, 159], [ 46, 159], [ 32, 185], [ 25, 199], [ 31, 145], [ 44, 112], [ 51, 82], [ 31, 34], [ 0, 0], [ 36, 27], [ 63, 64], [ 193, 75], [ 241, 64], [ 259, 52], [ 270, 72], [ 275, 87], [ 251, 98], [ 219, 126], [ 231, 164], [ 242, 187], [ 241, 199], [ 230, 187], [ 208, 152], [ 194, 150], [ 195, 185], [ 193, 199], [ 186, 189], [ 179, 160], [ 171, 140], [ 139, 142], [ 99, 154], [ 103, 192], [ 106, 204], [ 85, 191]]
def horsify(easting, northing)
HORSE.map { | point | [easting - point[0], northing - point[1]]}
.map { | point | "#{point[0].round} #{point[1].round}" }
.join(',')
end
def catify
CAT.map { | point | [easting - point[0], northing - point[1]]}
.map { | point | "#{point[0].round} #{point[1].round}" }
.join(',')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment