This file contains 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
# ___ _ ______ ____ | |
# / | | / / __ \/ __ \ | |
# / /| | | /| / / / / / / / / | |
# / ___ | |/ |/ / /_/ / /_/ / | |
# /_/ |_|__/|__/\____/\____/ | |
# | |
# @moeshitbot, by timgor | timgor.moe | |
# annotated source code | |
# | |
# this is my shitty cute anime pics twitter bot. |
This file contains 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
def fast_rot(width, height, raster): | |
for j in range(0, width): | |
for k in range(0, height): | |
to = width * height - (height * j + k + 1) | |
i = (width - j - 1) + width * k | |
if i != to: | |
while i > to: | |
i = width * (height - (i % height) - 1) + ((i - (i % height)) / height) | |
buffer = raster[int(i)] | |
raster[int(i)] = raster[int(to)] |