Spades Tutorial Part 0¶
Spades is a simple trick taking game. For details, see here. A quick summary:
- Must follow suit
- Spades are always trump
- More tricks are better
We will implement a simplified version with no bidding and no partners. In other words, the goal is to simply take as many tricks as possible.
Creating a new game prototype¶
Head to http://turn-base.com/ to access the game library.
Click on “Create Game” to create a new game prototype.
Click on “Details” in the card for the newly created game to access the game prototype editor:
You will see that there are some errors because an empty string doesn’t parse as JSON:
For now, open the game prototype editor for the completed Spades game and copy over its initial state json. This contains the set up for a standard 52-deck of playing cards.
Unlike the game you just created, you do not own this game and so cannot edit any of its properties, but you can still see the set up and rules.
Note that in this JSON, we have set the :ref:`prop <prop>`_ play_order
to ['player_0', 'player_1', 'player_2', 'player_3']
. So these are the positions that show up when you create an instance of spades:
After saving the new JSON, we still get an error message. This is because play_order
is saying there should be 4 players but we have set num_players
in the editor to 0:
So we update num_players
to 4. While we’re at it, we also set frontend-skin
to cards-4
. This is needed for the frontend to correct display the UI for a card game.
Now the JSON is accepted, but there is an error for the ruleset:
The error message is complaining that it did not find any RECEIVE directives, so we let’s give it a basic one.
This says that the backend will ACCEPT
any messages from the frontend of the form test
. This doesn’t do anything as far as the game is concerned, but now we’re ready to start writing the rules for Spades.