Skip to main content

N-Queen Problem

The "N-Queens Problem" is a classical problem of chess. Here N Queens are to be placed on an N * N chessboard in such a way that no queens attack each other. A Queen can attack other Queens if its placed on the same row, column or on its diagonals. We use Backtracking in the backend to solve this problem .

Usage

To Install this package. Use :

  pip install nqueens

Class Definition

class Queen:
     def __init__(self, n = 0, algo = "backtrack", pos = []):
          self.n = int(n)
          self.algo = algo
          self.pos = []
          self.count = 0
          self.queen_data = []

Use the below snippit to start using the package.

 from nqueens import * 

NQueens Possible Solution Space

qq = Queen(5)
qq.pprint()

Use scan_queen() class function to solve NQueens problem with image input.

image

qq = Queen(4, algo = "backtrack")
qq.scan_queen("q5.PNG")

NQueens Solution space as Voice output

  qq = Queen(4)
  qq.alexa()

NQueens Solution space as image output

  qq = Queen(4, algo = "backtrack")
  qq.display()

NQueens Solution space as PNG File output

  qq = Queen(4)
  qq.save()
Special Credits: https://python-packaging-tutorial.readthedocs.io/en/latest/setup_py.html
References: https://www.geeksforgeeks.org/printing-solutions-n-queen-problem/
Visit our GitHub Repository for more information: https://github.com/toshihiroryuu/nqueens---PyPI-Package

Release files for nqueens 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nqueens 1.0.4
File Size Uploaded
nqueens-1.0.4.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nqueens 1.0.4
File Interpreter ABI Platform
nqueens-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / nqueens-1.0.4.tar.gz

Download URL nqueens-1.0.4.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
002ab20fdff175a797521a54d17db20c6137ee87dcbb2bc6ba41bb63bf102a45
BLAKE2b-256 checksum
How to use checksums
d7c5c149e806ec7587cff19732d7b7e56cf1e720cfb580cb3853c52a73a88fee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

Release files / nqueens-1.0.4-py3-none-any.whl

Download URL nqueens-1.0.4-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
245a76855e11cde2acf6add0fdcc2cd9cba6eab498553186f31b01810f63fb8b
BLAKE2b-256 checksum
How to use checksums
6a557182e99dde0b6a284c293f99db0b04722f665e085c421363315d2f8fcd94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.6

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page