Last active
August 6, 2024 18:59
-
-
Save joereynolds/8c0d5dd5df3926106d65fe8bbfd40cdb to your computer and use it in GitHub Desktop.
Spatial grid prepopulation
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
| from collections import namedtuple | |
| from typing import Tuple | |
| cells: dict[Tuple[int, int], list] = { | |
| (i, j) : [] | |
| for i in range(10) | |
| for j in range(10) | |
| } | |
| unit = namedtuple('Point', ['x', 'y']) | |
| unit.x = 300 | |
| unit.y = 34 | |
| cells[(unit.x // 96, unit.y // 96)].append('testing') | |
| print(cells) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment