Last active
April 9, 2025 02:04
-
-
Save mike-pete/6264ece3de28d5f3529e2a60a9cdbb92 to your computer and use it in GitHub Desktop.
Directions Map - useful for direction based traversal
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
const direction = { | |
'↑': [-1, 0], | |
'↗': [-1, 1], | |
'→': [0, 1], | |
'↘': [1, 1], | |
'↓': [1, 0], | |
'↙': [1, -1], | |
'←': [0, -1], | |
'↖': [-1, -1], | |
} satisfies Record<string, [number, number]> | |
const direction = { | |
'up': [-1, 0], | |
'upRight': [-1, 1], | |
'right': [0, 1], | |
'downRight': [1, 1], | |
'down': [1, 0], | |
'downLeft': [1, -1], | |
'left': [0, -1], | |
'upLeft': [-1, -1], | |
} satisfies Record<string, [number, number]> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment