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
![Screenshot 2024-06-23 at 19 26 11](https://private-user-images.githubusercontent.com/1078546/342107540-881e7204-f1a6-4de2-a0b5-60faa43b4fac.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2ODg2NjQsIm5iZiI6MTcyNDY4ODM2NCwicGF0aCI6Ii8xMDc4NTQ2LzM0MjEwNzU0MC04ODFlNzIwNC1mMWE2LTRkZTItYTBiNS02MGZhYTQzYjRmYWMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjZUMTYwNjA0WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjFhNDdhMmJmNWU1YzEyN2U0ZWZkMGJmZTQ1ZDU5ZTA2MjkyMWFkYWU0NTMzNzkwNTFlMWJkYWM2ZjllZmM5MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.niyg40sXwhiILQiQqeKdty-x7jDVHWPgQRCLf2TAVzQ)
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.