Vouchr is a "truco" cardgame API that you can use to play with your friends for free
Vouchr is an API that allows you to simulate a Truco (cardgame) match. With POST and GET requests, you can simply create, manage and run a match.
A vouchr match works by rounds and rows. A round is a "deck hand", that is a submatch, divided by 3 or 4 rounds (in case of draw) - The first team to win all the rounds, win a row, recieving a specific pontuation (it can be: 1, 3, 6, 9, 12) determinated during the match.
To win a match, the team needs 12 points.
The app use the traditional truco card priorities to define the round winner. The cards in growing order are: 4, 5, 6, 7, Q, J, K, A, 2, 3
.
In case of two cards have the same value, the card with the major suit will win. The suits in growing order are: D, S, H, C
.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
What things you need to install the software and how to install them.
First, you need to install Yarn. Read more here
npm i yarn -g
And then, install all the needed packages with the command:
yarn
After t
First things first, you need to start runing the yarn app, using the comand: yarn dev
Then, a port will appear on your console, this port will be used on the requests.
Example: Listening on: http://localhost:8267
Here, the port used on the GET and POST request will be 8267
/match/create
Parameters: None
/player/create
{
"matchId":"<<matchId>>"
}
Parameters:
matchId(String)
/match/teams/create
{
"matchId":"<<matchId>>"
}
Parameters:
matchId(String)
/player/team/add
{
"playerId":"<<playerId>>",
"teamId":"<<teamId>>"
}
Parameters:
matchId(String)
teamId(String)
/events/cards/shuffle
{
"matchId":"<<matchId>>"
}
Parameters:
matchId(String)
/player/cards/list/:id
And then you'll recieve a response with all the card values, suits, codes and ids
/player/cards/play
{
"tableId":"<<tableId>>",
"card": "<<card>>"
}
Parameters:
matchId(String)
card(String)The card parameter refers to the card id
/events/rounds/finish
{
"tableId":"<<tableId>>",
"matchId":"<<matchId>>"
}
Parameters:
matchId(String)
tableId(String)
/events/truco
{
"tableId":"<<tableId>>",
"playerId":"<<playerId>>"
}
If the poll has the vote numbers equals half of the match player count, the truco event will be triggered and the match round value will increase. If the round value is equal to 1
, the new value will be equal to 3
, if the value is 6
, the new will be 9
, and if it is 9
, the new will be 12
, being twelve the max round value
/events/cards/clear
{
"matchId":"6166f4a41e3dfbf45a581408"
}
Parameters:
matchId(String)
/events/rows/finish
{
"matchId":"6166f4a41e3dfbf45a581408",
"tableId":"6166f4a71e3dfbf45a58140b"
}
Parameters:
matchId(String)
tableId(String)
- Typescript - Programming language
- MongoDB - Database
- Express - Server Framework
- NodeJs - Server Environment
- Yarn - Package manager
- Prisma - Database toolkit
- @IgorDuca - Idea & Initial work