Last active
December 29, 2022 17:09
-
-
Save ducaale/b2205f4f0f3ae665a0ad5116f18eb345 to your computer and use it in GitHub Desktop.
I am tired of having to solve this again and again
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
const gridToLine = (x, y, width, height) => { | |
return (y * width) + x; | |
} | |
const lineTogrid = (a, width, height) => { | |
const x = a % width; | |
const y = a / width; | |
return [x, y] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment