Skip to main content

bncpy

Benjamin and Charlotte

Installation

pip install bncpy

Usage

from bnc import Board, Game, Player
from bnc.utils import generate_guess, get_random_number

# Game configuration
config = {
  "code_length": 4,
  "num_of_colors": 6,
  "num_of_guesses": 10
}

# Create players with boards
players = [
  Player(name="Jae", board=Board(**config)),
  Player(name="Soo", board=Board(**config)),
  Player(name="Benjamin", board=Board(**config)),
  Player(name="Charlotte", board=Board(**config))
]

# Create game with secret code
secret_code = get_random_number(length=4, max_value=5)  # Random 4-digit code
game = Game(players, secret_code=secret_code)

# Submit guesses
game.submit_guess(players[0], "1234")
game.submit_guess(players[1], generate_guess(code_length, num_of_colors))  # Random guess

# Check game state
print(game.state)
players[0].board.display_board()

# Check winners
if game.winners:
  for winner in game.winners:
    print(f"Winner: {winner.name}")

Setting the secret code

  • Multiple ways to set secret codes:
    • Via Game initialization: Game(players, secret_code="1234")
    • Per player: player.set_secret_code_to_board("1234")
    • Random generation: game.set_random_secret_code()

Dependencies

Metadata

Release files for bncpy 0.2.0

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

Source distribution (sdist)

Source distribution for bncpy 0.2.0
File Size Uploaded
bncpy-0.2.0.tar.gz 6.4 kB Details

Built distribution (wheel)

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

Total release size: 9.0 kB

Release files / bncpy-0.2.0.tar.gz

Download URL bncpy-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d0a1a024a38ca36280be38f3caca4f13b7f74c4a67111461993f3d5c635ee703
BLAKE2b-256 checksum
How to use checksums
04c841a728c8d20b7cd81f01dc3ccd3102bb3997107dcd770e7e81b9500dafd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release files / bncpy-0.2.0-py3-none-any.whl

Download URL bncpy-0.2.0-py3-none-any.whl
Size 2.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00290bc65786fee2e8951ae66a5f5805dfe51083ccede620c0a8c53b73b803ce
BLAKE2b-256 checksum
How to use checksums
11af1c5a8938ba1d50e44f3022ab00d7c1e31454d9987bfcd47c8836b54e38b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

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