A simple script+module to find points in a row on a 2D plane
Project description
A simple script+module to find points in a row on a 2D plane.
Usecases are almost none, but I was bored.
Can be used for tic-tac-toe ig.
Script usage:
$ rowfind <row_size> x1,y1 x2,y2 x3,y3 ...
Module usage:
import rowfind
coords = [(0, 0), (1, 1), (2, 2), (2, 3), (2, 4), (5, 5), (4, 4)]
row_size = 3
rows = rowfind.find_rows(coords, row_size)
print("\n".join(str(row) for row in rows))
# Where `coords` is a list of (x, y) coordinates and `row_size` is
# the number of points in a row to find.
# The return value is a tuple of tuples, where each tuple is a group
# of points that form a row.
# To visualize the results:
graph = rowfind.draw_graph(coords, rows)
print(graph)
Output:
((0, 0), (1, 1), (2, 2))
((2, 2), (2, 3), (2, 4))
. . . . . O
. . X . O .
. . X . . .
. . X . . .
. X . . . .
X . . . . .
Build as wheel:
$ poetry build -f wheel -o dist
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rowfind-0.1.0.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file rowfind-0.1.0.tar.gz
.
File metadata
- Download URL: rowfind-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a604667d0ffca2a29fb6eaff3ae5fe07fde7713a0dcb2977edc913f43a8d724 |
|
MD5 | 9352e2e1adb37240bc85b132c8b18f25 |
|
BLAKE2b-256 | 72766a8f2c86ddec59ec4be2d0a0cc68465562517776ef2df29cf8e6034389d4 |
File details
Details for the file rowfind-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: rowfind-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b884d030e9eacabd8ef89eca078021bb2b9fc83e192f1d87ad8f0a84f38cc289 |
|
MD5 | 81235a14d27924f1131b1c97479cbaa6 |
|
BLAKE2b-256 | a4c598887b37aca5507549f198555445bdf2d9a1763d01e91e88228aec9d38f5 |