Overview
The project is to create a card-based battle game between two (computer) players in which they battle each other with action cards.
Game Play
In each turn, there is a battle in which the outcome is determined by the card types and values. After each turn, the current cards are discarded into the abyss. In some outcomes, one player may gain one card from the other or both may lose their cards into the abyss. The game continues until one player has lost all their cards. The player with any remaining cards wins.
Cards
Each player has a deck of cards, implemented with a linked list. Each card is a node in a linked list. There are three types of cards: ATTACK, DEFEND, and RUN. Here are the scenarios for each battle showdown between the two players.
ATTACK | DEFEND | RUN | |
ATTACK | If both players ATTACK, the player with the higher value wins. The winning player gets a new card, which will be added to their card list in the descending order of the card value. The losing player will lose their next card into the abyss. In a tie, nothing happens. | If one player ATTACKs and the other player DEFENDs, the player with the higher value wins. If the ATTACKing player wins, they get a new card added to their card list in the descending order of the card value and nothing happens to the DEFENDing player. If the DEFENDing player wins or ties, then the ATTACKing player loses their next card into the abyss. | If one player ATTACKs and the other player RUNs, the RUNning player loses their next card into the abyss. |
DEFEND | If both players DEFEND, nothing happens. | If one player DEFENDs and the other player RUNs, the DEFENDING player gets a new card added to their card list in the descending order of the card value. The RUNning player loses their next card into the abyss | |
RUN | If both players RUN, they both lose their next card and those cards disappear into the abyss. |
Task 1 – cards.h
typedef enum CardType { ATTACK, DEFEND, RUN } CardType;
Task 2 – cards.c
Write the following functions. These functions are typical linked list functions, but adapted for the game play.
Task 3 – project3-main.c
Write the main() to do the following.
Task 4: Create a makefile
Create a makefile to compile .
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more