Skip to main content

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)

# 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:
print("\n".join(str(row) for row in rows))
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.1.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

rowfind-0.1.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file rowfind-0.1.1.tar.gz.

File metadata

  • Download URL: rowfind-0.1.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for rowfind-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e82d87313a9de3442e0db7c7acc91030c2d5b06a4a3c83476fd53d6662b7d94c
MD5 def3c6a0d57a471826c2eda096961429
BLAKE2b-256 5e8f404ffbfe2173759ad853f8700eac7a803f1cd9733fc461093d6dcb707f0a

See more details on using hashes here.

File details

Details for the file rowfind-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rowfind-0.1.1-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

Hashes for rowfind-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5b7c1e960cdc56eaca22d47a800daf225f6f4d9942562a8ba2472001afde195
MD5 d9c8cd66351fac3def10ad4eeae949a9
BLAKE2b-256 4cf31d1b7ae39c6e1d1214412da6930ea26c28b6be6f9cb4c559f3c83adafd0a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page