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.3
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.3.tar.gz | 55.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytruco-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 104.7 kB
Release files / pytruco-0.1.3.tar.gz
| Download URL | pytruco-0.1.3.tar.gz |
|---|---|
| Size | 55.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d501ff2eb2cc5130fc0e74716b8e671e87567836046cb9c0259fd003fe91f3e0
|
|
BLAKE2b-256 checksum How to use checksums |
a05b6362288af521a14233a9035514721c7f91e11056f32e3fd02a22a019348e
|
| 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.3-py3-none-any.whl
| Download URL | pytruco-0.1.3-py3-none-any.whl |
|---|---|
| Size | 49.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f00d51014d030e8e8024c5796fe34cdf4cd558366f4926f18836af60bf8c0e10
|
|
BLAKE2b-256 checksum How to use checksums |
4321968fa9e7b8bf1933516dc4ec992a400715452b8ca8dd0971f4bab61a067a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.8
|