PvP Card Game

From UBC Wiki

Authors: Ali, Devon, Garima

What is the problem?

We will be creating a 1 vs 1 card game to be played between a human and an AI. The rules of the game will be as follows:

Each player will have 4 cards in their hand at a time (pulled from a pool of 10-15 unique cards). Each player starts with 30 health points (HP). The goal of the game is to make your opponent reach 0 HP.

Cards can perform 1 of 4 actions:

  • Simple attack: deal a certain amount of damage
  • Simple heal: recover a certain amount of HP, up to a maximum HP of 30
  • Blank card: performs no action
  • Special card: this card can do unique actions based on the state of the game
    • stacking damage: this card will accumulate damage based on the number of times it has been played in succession, until one player does not have this card, upon which they will immediately take the accumulated damage
    • skip turn: skips the opponent's next turn
    • mirror effect: after a player that uses the mirror_effect card, the opponent's next move will get mirrored on itself
    • skip: opponent skips their turn
    • freeze card: after a player uses the freeze card, the opponents next move can only be skip and heal

What is the something extra?

We will be implementing an AI that will choose and play cards at random. We also created a game server that will take requests from clients (players) to make moves based on the cards available.

What did we learn from doing this?

We learned how sockets work in prolog and their place in logical programming. We also learned:

  • How different programming in prolog is than other languages that we have previously used. It requires a different way of thinking.
  • We miss pattern matching from Haskell. Having to put conditions everywhere is very tedious.

Using random values in prolog was a big difficulty due to the aforementioned lack of pattern matching, as well as the various states that must be matched.

Work division

  • Ali - base game
  • Garima - cards and gameplay
  • Devon - Networking

Links to code etc.

https://github.com/devon-mar/UBC-CPSC312-project2