Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Used when generating images from regular expressions (
def get_region_identifier(x, y, resolution):
region_identifier = ""
for i in range(resolution):
r = int((y % 2**(resolution-i)) / 2**(resolution-1-i))
c = int((x % 2**(resolution-i)) / 2**(resolution-1-i))
region_identifier += chr(int((1-r)*c + r*(3-c)) + 48)
return region_identifier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.