Skip to content

marianogappa/truco

Repository files navigation

Truco

https://marianogappa.github.io/truco-argentino/

Truco argentino implementation, featuring:

game

Screenshot 2024-06-23 at 19 26 11

Installation

Either install using Go

$ go install https://github.com/marianogappa/truco@latest

Or download the latest release binary for your OS.

Usage

Start a server

$ truco server

You may change the port (default is 8080) via environment variable

$ PORT=1234 truco server

If you want to play via example terminal-based frontend, start two clients on separate terminals

$ truco player 1
$ truco player 2

Playing with someone else over the Internet

Whoever starts the server may expose it to the Internet somehow, e.g. via cloudflared tunnels

$ cloudflared tunnel --url localhost:8080

Then, the clients can connect to the address the tunnel provides, e.g. if tunnel says

...
2024-06-23T18:35:10Z INF +--------------------------------------------------------------------------------------------+
2024-06-23T18:35:10Z INF |  Your quick Tunnel has been created! Visit it at (it may take some time to be reachable):  |
2024-06-23T18:35:10Z INF |  https://retail-curves-bernard-affairs.trycloudflare.com                                   |
2024-06-23T18:35:10Z INF +--------------------------------------------------------------------------------------------+

Start the clients with

$ truco player 1 retail-curves-bernard-affairs.trycloudflare.com
$ truco player 2 retail-curves-bernard-affairs.trycloudflare.com

Reconnect after issue

If the server dies, state is gone. If client dies, you can simply reconnect to the same server and game goes on.

I don't like your UI

It's just an example UI. I encourage you to implement your own frontend. You may browse the documentation and the existing React-based UI code and terminal UI code to guide your implementation.

I don't like your Bot

It's just an example bot, which beats me. I encourage you to implement your own bot. You may browse the documentation and the existing bot code to guide your implementation.

Technology stack

  • This truco engine is written 100% in Go
  • Terminal-based UI uses Termbox
  • React-based UI uses TinyGo with WASM target to transpile to WebAssembly, and the frontend itself is built in React

Known issues / limitations

  • Don't resize your terminal. This is a go-termbox issue. Also, have a terminal with a decent viewport. That is on me mostly.

Issues / Improvements

Please do create issues and send PRs. Also feel free to reach me for comments / discussions. I'm not hard to find.