Benjamin and Charlotte game
Project description
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(number=4, maximum=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(4, 6)) # 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()
- Via Game initialization:
Dependencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bncpy-0.1.1.tar.gz
(6.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
bncpy-0.1.1-py3-none-any.whl
(2.6 kB
view details)
File details
Details for the file bncpy-0.1.1.tar.gz.
File metadata
- Download URL: bncpy-0.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8baa3e91d0a024143390c1f416f8d612b78b3a332a953bb0d6d05f5ccc392d7a
|
|
| MD5 |
f68c35d64ae23eb655e56bc67b5ec2db
|
|
| BLAKE2b-256 |
0a0cb03b767b771a9e8826b8b13c598b01439bf5fd8bbc3aaed474b7da37a451
|
File details
Details for the file bncpy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bncpy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ce81fca51476e058edab1dcaa7567cffcba334ed0da87e1c79f32643feac0c8
|
|
| MD5 |
696d5d4ad521b17bafc19b8a002a0f69
|
|
| BLAKE2b-256 |
f42cc85034cd08bb3ad302d70dcfb32ce92b25a75fcd42c5bd1dd71096b8d461
|