Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Card game

This is a simple card game built using object oriented programming with python.

Instructions

  1. There are two players in this game. Each player gets half a deck(26 cards)
  2. In each round the players put out 1 card and the values of the cards are compared.
  3. the player with the higher value gets both the cards.
  4. Incase both the values are equal, there is a WAR.
  5. When at war compare the last card in the deck of each player and repeat steps 2 and 3.
  6. 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.

Setup

This code can be run on any python IDE of jupyter notebook.

Purpose of adding this project

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.

Uses

This game can be used as a base or an introduction to build more advanced card games.

compiling the code

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

The code is explained as comments wherever necassary.

Libraries imported-random

Screenshot of output

Click here!!--> Output

Author : Manasa, github: Manasa2811