This commit is contained in:
Neemek 2025-11-06 16:42:22 +01:00
commit 14a17e01a9
Signed by: neemek
GPG key ID: 84FFE4D7D40AB25E
6 changed files with 55 additions and 0 deletions

10
.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info
# Virtual environments
.venv

1
.python-version Normal file
View file

@ -0,0 +1 @@
3.13

0
README.md Normal file
View file

29
main.py Normal file
View file

@ -0,0 +1,29 @@
w = 3
h = 3
def main():
path = [(0,0)]
paths = find_paths(path, set())
print(len(paths))
print('\n'.join(str(path) for path in paths))
def find_paths(path: list[tuple[int, int]], paths: set[list[tuple[int, int]]]):
x, y = path[-1]
if x == w - 1 and y == h - 1:
paths.add(tuple(path))
return paths
for mv in ((0, 1), (1, 1), (1, 0)):
nx = x + mv[0]
ny = y + mv[1]
if nx < w and ny < h:
path.append((nx, ny))
paths = find_paths(path, paths)
path.pop()
return paths
if __name__ == "__main__":
main()

7
pyproject.toml Normal file
View file

@ -0,0 +1,7 @@
[project]
name = "abel-paths"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = []

8
uv.lock generated Normal file
View file

@ -0,0 +1,8 @@
version = 1
revision = 3
requires-python = ">=3.13"
[[package]]
name = "abel-paths"
version = "0.1.0"
source = { virtual = "." }