in ttw/data_loader.py [0:0]
def get_orientation_keys(x, y, cross_the_street=False):
"""Get orientations at location (x,y) st you're facing landmarks.
"""
if x % 2 == 0 and y % 2 == 0:
k = ["{}_{}_{}".format(x, y, 'W1'),
"{}_{}_{}".format(x, y, 'W2'),
"{}_{}_{}".format(x, y, 'S1'),
"{}_{}_{}".format(x, y, 'S2')]
if cross_the_street:
k += ["{}_{}_{}".format(x + 1, y, 'W1'),
"{}_{}_{}".format(x + 1, y, 'W2'),
"{}_{}_{}".format(x, y + 1, 'S1'),
"{}_{}_{}".format(x, y + 1, 'S2')]
return k
if x % 2 == 1 and y % 2 == 0:
k = ["{}_{}_{}".format(x, y, 'E1'),
"{}_{}_{}".format(x, y, 'E2'),
"{}_{}_{}".format(x, y, 'S1'),
"{}_{}_{}".format(x, y, 'S2')]
if cross_the_street:
k += ["{}_{}_{}".format(x - 1, y, 'E1'),
"{}_{}_{}".format(x - 1, y, 'E2'),
"{}_{}_{}".format(x, y + 1, 'S1'),
"{}_{}_{}".format(x, y + 1, 'S2')]
return k
if x % 2 == 0 and y % 2 == 1:
k = ["{}_{}_{}".format(x, y, 'W1'),
"{}_{}_{}".format(x, y, 'W2'),
"{}_{}_{}".format(x, y, 'N1'),
"{}_{}_{}".format(x, y, 'N2')]
if cross_the_street:
k += ["{}_{}_{}".format(x + 1, y, 'W1'),
"{}_{}_{}".format(x + 1, y, 'W2'),
"{}_{}_{}".format(x, y - 1, 'N1'),
"{}_{}_{}".format(x, y - 1, 'N2')]
return k
if x % 2 == 1 and y % 2 == 1:
k = ["{}_{}_{}".format(x, y, 'E1'),
"{}_{}_{}".format(x, y, 'E2'),
"{}_{}_{}".format(x, y, 'N1'),
"{}_{}_{}".format(x, y, 'N2')]
if cross_the_street:
k += ["{}_{}_{}".format(x - 1, y, 'E1'),
"{}_{}_{}".format(x - 1, y, 'E2'),
"{}_{}_{}".format(x, y - 1, 'N1'),
"{}_{}_{}".format(x, y - 1, 'N2')]
return k