# bncpy
Benjamin and Charlotte
## Installation
```bash
pip install bncpy
```
## Usage
```python
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
- [httpx](https://github.com/encode/httpx)
Raw data
{
"_id": null,
"home_page": null,
"name": "bncpy",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "game, bulls-and-cows, bulls, cows, mastermind",
"author": "Jae W. Choi",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/04/c8/41a728c8d20b7cd81f01dc3ccd3102bb3997107dcd770e7e81b9500dafd2/bncpy-0.2.0.tar.gz",
"platform": null,
"description": "# bncpy\n\nBenjamin and Charlotte\n\n## Installation\n\n```bash\npip install bncpy\n```\n\n## Usage\n\n```python\nfrom bnc import Board, Game, Player\nfrom bnc.utils import generate_guess, get_random_number\n\n# Game configuration\nconfig = {\n \"code_length\": 4,\n \"num_of_colors\": 6,\n \"num_of_guesses\": 10\n}\n\n# Create players with boards\nplayers = [\n Player(name=\"Jae\", board=Board(**config)),\n Player(name=\"Soo\", board=Board(**config)),\n Player(name=\"Benjamin\", board=Board(**config)),\n Player(name=\"Charlotte\", board=Board(**config))\n]\n\n# Create game with secret code\nsecret_code = get_random_number(length=4, max_value=5) # Random 4-digit code\ngame = Game(players, secret_code=secret_code)\n\n# Submit guesses\ngame.submit_guess(players[0], \"1234\")\ngame.submit_guess(players[1], generate_guess(code_length, num_of_colors)) # Random guess\n\n# Check game state\nprint(game.state)\nplayers[0].board.display_board()\n\n# Check winners\nif game.winners:\n for winner in game.winners:\n print(f\"Winner: {winner.name}\")\n```\n\n## Setting the secret code\n\n- **Multiple ways to set secret codes:**\n - Via Game initialization: `Game(players, secret_code=\"1234\")`\n - Per player: `player.set_secret_code_to_board(\"1234\")`\n - Random generation: `game.set_random_secret_code()`\n\n## Dependencies\n\n- [httpx](https://github.com/encode/httpx)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Benjamin and Charlotte game",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/jwc20/bncpy",
"Issues": "https://github.com/jwc20/bncpy/issues",
"Repository": "https://github.com/jwc20/bncpy.git"
},
"split_keywords": [
"game",
" bulls-and-cows",
" bulls",
" cows",
" mastermind"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "11af1c5a8938ba1d50e44f3022ab00d7c1e31454d9987bfcd47c8836b54e38b4",
"md5": "e49c3d917c6ff13a0668a5f0785a6e28",
"sha256": "00290bc65786fee2e8951ae66a5f5805dfe51083ccede620c0a8c53b73b803ce"
},
"downloads": -1,
"filename": "bncpy-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e49c3d917c6ff13a0668a5f0785a6e28",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 2652,
"upload_time": "2025-08-11T16:16:09",
"upload_time_iso_8601": "2025-08-11T16:16:09.297892Z",
"url": "https://files.pythonhosted.org/packages/11/af/1c5a8938ba1d50e44f3022ab00d7c1e31454d9987bfcd47c8836b54e38b4/bncpy-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "04c841a728c8d20b7cd81f01dc3ccd3102bb3997107dcd770e7e81b9500dafd2",
"md5": "6c5bac70205d2e1ae5c246d177e4d586",
"sha256": "d0a1a024a38ca36280be38f3caca4f13b7f74c4a67111461993f3d5c635ee703"
},
"downloads": -1,
"filename": "bncpy-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "6c5bac70205d2e1ae5c246d177e4d586",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 6389,
"upload_time": "2025-08-11T16:16:10",
"upload_time_iso_8601": "2025-08-11T16:16:10.211733Z",
"url": "https://files.pythonhosted.org/packages/04/c8/41a728c8d20b7cd81f01dc3ccd3102bb3997107dcd770e7e81b9500dafd2/bncpy-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-11 16:16:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jwc20",
"github_project": "bncpy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "anyio",
"specs": [
[
"==",
"4.10.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2025.8.3"
]
]
},
{
"name": "h11",
"specs": [
[
"==",
"0.16.0"
]
]
},
{
"name": "httpcore",
"specs": [
[
"==",
"1.0.9"
]
]
},
{
"name": "httpx",
"specs": [
[
"==",
"0.28.1"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.10"
]
]
},
{
"name": "jsonpickle",
"specs": [
[
"==",
"4.1.1"
]
]
},
{
"name": "sniffio",
"specs": [
[
"==",
"1.3.1"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
"==",
"4.14.1"
]
]
}
],
"lcname": "bncpy"
}