pytruco
pytruco is a pure Python Uruguayan Truco engine, simulator, and library.
Install
pip install pytruco
Example
from pytruco.pdt.partida import Partida
p = Partida(
puntuacion = 20,
azules = ["Alice", "Ariana"],
rojos = ["Bob", "Ben"],
verbose = True,
limite_envido = 4
)
print(p)
print(p.cmd("alice envido"))
print(p.cmd("bob quiero"))
print(p.cmd("ariana truco"))
print(p.cmd("ben quiero"))
Random walker example
from pytruco.pdt.partida import Partida
from pytruco.pdt.chi import chis
import random
def random_action(p:Partida, allow_mazo=True):
aas = chis(p, allow_mazo)
aas = [aa for aa in aas if len(aa) > 0]
aa = random.choice(aas)
return random.choice(aa)
p = Partida(
puntuacion = 20,
azules = ["Alice", "Ariana"],
rojos = ["Bob", "Ben"],
verbose = True,
limite_envido = 4
)
print(p)
while not p.terminada():
a = random_action(p, allow_mazo=False)
pkts = a.hacer(p)
print(f"{a} -> {pkts}")
Metadata
Release files for pytruco 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 | |
|---|---|---|---|
| pytruco-0.1.2.tar.gz | 54.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytruco-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 103.1 kB
Release files / pytruco-0.1.2.tar.gz
| Download URL | pytruco-0.1.2.tar.gz |
|---|---|
| Size | 54.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbbb0d4b2b70c598ab3de8d3f9766b8ef52a499ae335169d8f8318f709ef6f6a
|
|
BLAKE2b-256 checksum How to use checksums |
e0b9977b4d95da30fe1e9273fa413542fe919f8d8a4f422fc2195c68cea8c658
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.8
|
Release files / pytruco-0.1.2-py3-none-any.whl
| Download URL | pytruco-0.1.2-py3-none-any.whl |
|---|---|
| Size | 48.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52fe99b43e1131c146b320396c7d9ac0929f6ac98f92f5fcf2e72db3fafa58cc
|
|
BLAKE2b-256 checksum How to use checksums |
73458c7b762fccf51690abc7c41c603a70ec113dd40885cd6c7120ad2c8ba47d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.8
|