Code Kata: Trading Card Game (TCG)
In this Code Kata you will be implementing a two-player trading card game. The rules are loosely based on Hearthstone - Heroes of Warcraft®. This Kata is supposed to be slightly more complex than some of the well-known traditional Katas (e.g. Roman Numbers, Bowling Game or FizzBuzz) especially when adding some of the Advanced Variations proposed below. Kata TCG leaves room for different focuses (like playing cards based on user input and/or algorithmic decision logic) and can be approached iteratively with TDD from different angles. The Kata should also be well suited for your own rule extensions and modifications. It should offer challenges for developers of all experience levels.
Kata TCG is now listed in the Kata Catalogue hosted at codingdojo.org: http://codingdojo.org/cgi-bin/index.pl?KataTradingCardGame
When the normal game rules have become too easy/boring you might consider adding some additional rules like those described below. Some of them will increase the complexity of the game significantly, so you might not want to use all extra rules at once:
|When playing a card the active player can choose to use it for causing damage (see Basic Gameplay) or for healing himself by a value equal to the mana cost amount.|
|Players cannot heal up above 30 health.|
|Let players choose to play cards either as immediate damage Attacks (same as cards generally worked in the Basic Gameplay rules) or as Minions that are put on the board instead. Minions will use the mana cost of their card as Health and Damage value.|
|Health has to be tracked when they receive damage.|
|Each player can have a maximum of 3 Minions on the board at any given time.|
|A Minion will sleep in the turn it was put on the board.|
|In any subsequent turn each Minion can be used once to deal damage to the opponent player or an opponent Minion.|
|A Minion fighting another Minion will result in them dealing their damage value to each other simultaneously.|
|Sleeping Minions will defend themselves in the same way when attacked by another Minion.|
|Players can choose to play an Attack against a Minion. The attacked Minion will not defend itself in this case, thus the attacking player receives no damage from it.|
|When a Minions health drops to or below zero it is removed from the board.|
- Let Mana cost and damage dealt be different from each other thus making cheap powerful, expensive mediocre or entirely useless cards possible. This can add a whole new layer of play strategy as some cards might not be desired to be ever played, but eventually have to in order to free your hand for better cards.
- Introduce Card Drawer cards that cost Mana but don't do any damage. Instead they let you draw a given number of cards from your deck. Those cards can be used in the current turn or later on (just as if normally drawn at the beginning of the active player's turn).
- Allow players to create their own decks of 20 cards from a larger Card Pool. Let those decks be saved to and loaded from disk before starting a game.