Retired
Strategy Card Game (retired)
Description:
In this simplified simulation of a strategy card game, two or more players summon creatures from the cards to battle ... You must create a function that will receive a list of strings, each string representing a player's deck:
Example:
card_game([
'5 (3, 2) 3 (1, 2) 3 (2, 1) 6 (4, 2) 8 (3, 5)', ## ---- player 0
'4 (1, 3) 2 (1, 1) 7 (3, 4) 7 (2, 5) 5 (1, 4)' ## ---- player 1
])
... where '5 (3, 2)' represents the card with (cost) 5 mana, 3 attack and 2 health.
Output:
The card_game
function should return a list of the winners of the match. In the example above, there are 3 possibilities:
- [0] => the first player won;
- [1] => the second player won;
- [0, 1] => The two players drew.
At the end of the game, surviving players are considered winners.
Sequence of the game:
- 1 - The current player spends mana points to make his first card attack the opponent's first card (Each player starts with 10 mana points -- "opponent" is the next player on the player list.);
- 2 - The damage caused by the attack of one card affects the health of the other card mutually, so the card that has 0 or less health points, dies and leaves the game.
- 3 - The player who has no mana points to make an attack, must sacrifice his first card (kill it) to obtain the mana for that card: As in item 2, the dead card leaves the game. The player cannot attack this turn.
- 4 - Players who cannot play (neither attack nor sacrifice) are out of the game.
- 5 - The next player becomes the current player and a new turn begins (item 1).
Attention: Each game has a limit of 25 turns!
Puzzles
Similar Kata:
Stats:
Created | Jul 17, 2020 |
Warriors Trained | 16 |
Total Skips | 0 |
Total Code Submissions | 210 |
Total Times Completed | 7 |
Python Completions | 7 |
Total Stars | 0 |
% of votes with a positive feedback rating | 0% of 4 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 2 kyu |
Lowest Assessed Rank | 8 kyu |