Metadata-Version: 2.4
Name: pytruco
Version: 0.1.1
Summary: Uruguayan Truco engine, simulator, and library
Author-email: JP Filevich <juanfilevich@gmail.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/truquito/pytruco
Project-URL: Repository, https://github.com/truquito/pytruco
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# pytruco

`pytruco` is a pure Python Uruguayan Truco engine, simulator, and library.

## Install

```sh
pip install pytruco
```

### Example

```py
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

```py
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}")
```
