Skip to content

Instantly share code, notes, and snippets.

@tomhartley
Created February 19, 2015 21:59
Show Gist options
  • Save tomhartley/c00f708db7a868a3ee36 to your computer and use it in GitHub Desktop.
Save tomhartley/c00f708db7a868a3ee36 to your computer and use it in GitHub Desktop.
def map_x(i):
a= int((i - XLEFT) / (1.0 * (XRIGHT - XLEFT)) * 100)
if (a<0):
return 0
if (a>99):
return 99
return a
def map_y(i):
a = int((-i + YTOP) / (1.0 * (YTOP - YBOTTOM)) * 50)
if (a<0):
return 0
if (a>49):
return 49
return a
def dothething(input_x,input_y):
# print input_x, input_y
input_x = map_x(input_x)
input_y = map_y(input_y)
# return
#print input_x, input_y
# print(chr(27) + "[2J")
sys.stderr.write("\x1b[2J\x1b[H")
for y in range(50):
s = ""
for x in range(100):
if abs(input_x- x)<=1 and abs(input_y-y)<=1:
s += "*"
else:
s +=" "
print s
time.sleep(0.02)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment