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(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()
- 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.2.0.tar.gz
(6.4 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.2.0-py3-none-any.whl
(2.7 kB
view details)
File details
Details for the file bncpy-0.2.0.tar.gz.
File metadata
- Download URL: bncpy-0.2.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0a1a024a38ca36280be38f3caca4f13b7f74c4a67111461993f3d5c635ee703
|
|
| MD5 |
6c5bac70205d2e1ae5c246d177e4d586
|
|
| BLAKE2b-256 |
04c841a728c8d20b7cd81f01dc3ccd3102bb3997107dcd770e7e81b9500dafd2
|
File details
Details for the file bncpy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bncpy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.7 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 |
00290bc65786fee2e8951ae66a5f5805dfe51083ccede620c0a8c53b73b803ce
|
|
| MD5 |
e49c3d917c6ff13a0668a5f0785a6e28
|
|
| BLAKE2b-256 |
11af1c5a8938ba1d50e44f3022ab00d7c1e31454d9987bfcd47c8836b54e38b4
|