- There are two players in this game. Each player gets half a deck(26 cards)
- In each round the players put out 1 card and the values of the cards are compared.
- the player with the higher value gets both the cards.
- Incase both the values are equal, there is a WAR.
- When at war compare the last card in the deck of each player and repeat steps 2 and 3.
- The first player to have less than 5 cards loses the game. NOTE: This is a simple non responsive game, hence both the players are computer bots.
This code can be run on any python IDE of jupyter notebook.
The main purpose of this project is to use object oriented programming and apply the concept of classes to games. It is simple and properly explained which makes it easy for beginners to understand the concept.
This game can be used as a base or an introduction to build more advanced card games.
The code can be compiled on any text editors like VScode, pycharm, jupyter notebook etc. If you want to compile it on command prompt, go to the directory where the file is located and use the command: python card_game.py
Libraries imported-random
Click here!!--> Output