Skip to main content

finding and counting solutions of tilingpuzzles like Pentomino

Project description

Count Solutions

tilingPuzzles

Finding a solution

from tilingpuzzles.games.stone import Stone
from tilingpuzzles.games.komino import Komino

# Degree of the stones
# k=5 => Pentomino
k=6

# The Universe of the Coverage problem
U="""
#######
#######
  ###
#######
#######
  ###
  ######
  #######
  #######
"""

U=Stone.from_string(U)

assert len(U)%k==0

display(U)

komi=Komino(U,k=k)
# limits: number of times a stone of a certain shape can be used.
komi.find_solution(limits=1)

[frozenset({(7, 7), (8, 6), (8, 7), (8, 8), (9, 7), (9, 8)}),
 frozenset({(5, 2), (6, 2), (6, 3), (7, 2), (7, 3), (8, 2)}),
 frozenset({(6, 4), (7, 4), (7, 5), (7, 6), (8, 4), (8, 5)}),
 frozenset({(8, 3), (9, 2), (9, 3), (9, 4), (9, 5), (9, 6)}),
 frozenset({(3, 2), (4, 0), (4, 1), (4, 2), (5, 0), (5, 1)}),
 frozenset({(2, 3), (3, 3), (4, 3), (5, 3), (5, 4), (5, 5)}),
 frozenset({(2, 4), (3, 4), (4, 4), (4, 5), (4, 6), (5, 6)}),
 frozenset({(1, 3), (1, 4), (1, 5), (1, 6), (2, 5), (2, 6)}),
 frozenset({(1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)})]

Calculate the number of Solutions if every Stone can be used a unlimited amount of time

komi.count_solutions(limits=None,progressLevel=0)
115373

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

tilingpuzzles-0.2.4.tar.gz (44.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tilingpuzzles-0.2.4-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file tilingpuzzles-0.2.4.tar.gz.

File metadata

  • Download URL: tilingpuzzles-0.2.4.tar.gz
  • Upload date:
  • Size: 44.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.3

File hashes

Hashes for tilingpuzzles-0.2.4.tar.gz
Algorithm Hash digest
SHA256 c43d88ae4a2f02f3c9fddca376e425fe15358cd90784fbec9690f97a5a0b815a
MD5 78352a157be96d687b49e6dfc318c389
BLAKE2b-256 0c8d1061a69513bd60619b155924c5dff7149679bb4db4feaa398f8fe7234122

See more details on using hashes here.

File details

Details for the file tilingpuzzles-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for tilingpuzzles-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7012bca2ec22b50002a914d1e17517c448bf8903e989394a550d7b7078432f8b
MD5 274b649c6117725697b9e26ba0c27b12
BLAKE2b-256 b3d2fc07567faf19411fb180879c581df4a576b8b2cc1b0c4909fa4fc678d506

See more details on using hashes here.

Supported by

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