Course:CPSC312-2023/Go Fish!

From UBC Wiki

Authors: Nicholas, Usman

What is the problem?

We are creating an implementation in Prolog of the card game Go Fish! Go Fish is a game in which players try to create as many pairs of cards as possible by picking a card in their hand and asking another player if they have that card, if the other player has that card, they give it to you; however, If the player you ask for a card from does not have the card you asked for, you draw a card from the deck. The game ends when any player has no cards in their hand or the deck has no cards left to draw. Whoever has the most pairs at the end of the game wins!

What is the something extra?

We are planning on also implementing an AI, which in this case, would be able to play a non-zero sum (not predictable) game.

What did we learn from doing this?

- How easy it is to modularize programs by testing predicates.

- How to take in user input, process it, and then use it.

- How intuitive it is to use predicates.

The core of the game requires keeping track of the deck and the players' hands and taking in input. We were easily able to keep track of what was being inputted and outputted by the predicates, and since they only returned true or false, we didn't have to worry about type checking variables, making it very easy to keep track of all the cards. Furthermore, user inputted values were able to be treated normally after some processing, unlike Haskell. Therefore, we found Prolog to be suitable for making Go Fish!

Links to code etc.

https://github.com/nicxlr8/go_fish_prolog