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.

../../_images/spades_0.png

Click on “Create Game” to create a new game prototype.

../../_images/spades_1.png

Click on “Details” in the card for the newly created game to access the game prototype editor:

../../_images/spades_2.png

You will see that there are some errors because an empty string doesn’t parse as JSON:

../../_images/spades_3.png

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.

../../_images/spades_4.png

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:

../../_images/spades_9.png

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:

../../_images/spades_5.png

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.

../../_images/spades_6.png

Now the JSON is accepted, but there is an error for the ruleset:

../../_images/spades_7.png

The error message is complaining that it did not find any RECEIVE directives, so we let’s give it a basic one.

../../_images/spades_8.png

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.