https://marianogappa.github.io/truco-argentino/
Truco argentino implementation, featuring:
- websocket-based client/server architecture
- example terminal-based frontend
- example React-based frontend, and a simple, documented interface for making your own frontend
- example bot, and a simple, documented interface for making your own
Either install using Go
$ go install https://github.com/marianogappa/truco@latest
Or download the latest release binary for your OS.
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
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
If the server dies, state is gone. If client dies, you can simply reconnect to the same server and game goes on.
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.
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.
- 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
- Don't resize your terminal. This is a go-termbox issue. Also, have a terminal with a decent viewport. That is on me mostly.
Please do create issues and send PRs. Also feel free to reach me for comments / discussions. I'm not hard to find.