libbisca
A Python bisca library
libbisca is a Python bisca library. Bisca is a Portuguese trick-taking card game.
State: Alpha (still needs a lot of work)
This is a small hobby project. In the future I may write a BiscaAI (game engines) and a Bisca GUI (probably using tkinter) on top of this. Keeping them separate should allow anyone else to use libbisca (the game rules) without the rest.
Usage example (non-exhaustive)
>>> import libbisca as bisca
>>> state = bisca.get_state()
>>> state
State(hand_size=3, turn=South, stock=[5D, 6H, 5C, QD, AH, QH, KS, 6S, QS, 4C, 4S, 7H, 5H, 3C, AC, 2C, JD, KC, AD, 2D, 4H, KH, AS, KD, QC, 3D, 4D, 3S, JS, JC, 3H, 2S, 5S, 7S], trump=5D, players={North: PlayerState(hand=[7C, 2H, 7D], pile=[], score=0), South: PlayerState(hand=[6C, JH, 6D], pile=[], score=0)}, table=[])
>>> state.play(bisca.get_card("4D"))
>>> state
State(hand_size=3, turn=North, stock=[2C, 7D, QC, JC, 5S, 3H, 7S, JH, AH, 2H, 5C, 5D, QD, 7H, 5H, JS, 3S, 6H, JD, KH, KD, 6S, QS, KS, 3C, AD, 6D, KC, 4S, AC, 6C, AS, 4H, 4C], trump=2C, players={North: PlayerState(hand=[2S, QH, 3D], pile=[], score=0), South: PlayerState(hand=[2D, 7C], pile=[], score=0)}, table=[4D])
>>> state.do_random_move()
(QH, (South, 2, [4D, QH], [4C, 4H]))
>>> state
State(hand_size=3, turn=South, stock=[2C, 7D, QC, JC, 5S, 3H, 7S, JH, AH, 2H, 5C, 5D, QD, 7H, 5H, JS, 3S, 6H, JD, KH, KD, 6S, QS, KS, 3C, AD, 6D, KC, 4S, AC, 6C, AS], trump=2C, players={North: PlayerState(hand=[2S, 3D, 4H], pile=[], score=0), South: PlayerState(hand=[2D, 7C, 4C], pile=[[4D, QH]], score=2)}, table=[])
>>> state.do_random_rollout()
>>> state
State(hand_size=3, turn=North, stock=[], trump=2C, players={North: PlayerState(hand=[], pile=[[7H, 5C], [3C, 5D], [7D, 2C], [5S, 3H]], score=20), South: PlayerState(hand=[], pile=[[4D, QH], [2D, 2S], [7C, 3D], [AC, 4S], [AS, 6D], [KC, 6C], [KS, 4H], [AD, KD], [6S, JD], [4C, QS], [KH, 3S], [JS, QD], [5H, AH], [7S, JH], [JC, QC], [6H, 2H]], score=100)}, table=[])
>>> state.is_endgame()
True
>>> state.legal_moves
[]
>>> state.get_winner()
South
>>> state.players[bisca.Player.SOUTH].score
100
Development setup
Assuming you are working on linux and have pipenv installed, do:
make install
make unit
Release History
This project follows Keep a Changelog, so all information is in CHANGELOG.md.
License and author info
Nuno Miguel Casteloa da Silva -- NunoMCSilva@gmail.com
Distributed under the GPL 3.0 license. See LICENSE.md for more information.
https://github.com/NunoMCSilva/libbisca
Thanks
My thanks to all the projects, articles and code that inspired/helped me. There are too many to list here independently.
Metadata
Release files for libbisca 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| libbisca-0.1.2.tar.gz | 9.5 kB | Without provenance | Details for libbisca-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| libbisca-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for libbisca-0.1.2-py3-none-any.whl |
Total release size: 33.3 kB
Release files / libbisca-0.1.2.tar.gz
| Download URL | libbisca-0.1.2.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37e353a08399362ab48310a787a13b85a8cde4bf02ae5e22d17d34f9a73e0a03
|
|
BLAKE2b-256 checksum How to use checksums |
423cf85dbbac23e9391e6790460cf0d13c20472dd08406781bd9ad25d8766c2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.3
|
Release files / libbisca-0.1.2-py3-none-any.whl
| Download URL | libbisca-0.1.2-py3-none-any.whl |
|---|---|
| Size | 23.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e28c477088ce01e516f0cc8c6130129ef107ddb6360e3e959e1caa6af10c5dd3
|
|
BLAKE2b-256 checksum How to use checksums |
957247cda5370ba87372dcd9fa70096a662e8874c6933440f51da3a484201003
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.7.3
|
Security for libbisca 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.