Created
September 18, 2019 19:40
-
-
Save molarmanful/3cba6ae8f8911bac204fc6ac02ec0316 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 move_wrap(d): | |
if d == 'up': | |
POS = (POS - COLS) % ROWS | |
if d == 'down': | |
POS = (POS + COLS) % ROWS | |
if d == 'left': | |
POS = POS - 1 if POS % COLS else POS + COLS - 1 | |
if d == 'right': | |
POS = POS + 1 if (POS + 1) % COLS else POS - COLS + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment