Last active
September 18, 2019 19:29
-
-
Save molarmanful/a18bac9fd4c64c7dafe0ace2b90bc09b 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(d): | |
if d == 'up' and POS - COLS >= 0: | |
POS -= COLS | |
if d == 'down' and POS + COLS < ROWS * COLS: | |
POS += COLS | |
if d == 'left' and POS % COLS: | |
POS -= 1 | |
if d == 'right' and (POS + 1) % COLS: | |
POS += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment