Skip to content

This is console version of the War card game made as a exercise to practice object oriented programming. The game essentially plays itself in this version and should be treated only as a demonstration of my experience.

Notifications You must be signed in to change notification settings

gadekd/War_Card_Game_Console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

War_Card_Game_Console

This is console version of the card game known as War. It should only be treated as a demonstration of my skillset and my expeience, since it essentially plays itself. It is made as a exercise to practice object oriented programming.

Summary

The game is enclosed within one python file.

The first part of it contains classes and functions which are describing objects taking part in the game. They are as follows:

Deck - object of a card deck which contains functions for creating a deck, shuffling it and distributing cards to players

Hand - object of a hand. Every player has a hand that contains 26 cards (deck of 52 cards is splitted in half). It can add or remove cards

Player - object of a player that can play cards or check if they still has cards to play

Rules of the game

War is relatively simple game. Each player has on their hand 26 cards that they draw one at the time. The player whose card has higher rank wins and the winner takes both cards. However, if players draw cards with identical rank, it starts the war. In this scenario players have to put another card from their deck face down on the already drawn cards. And then, one more, on top of these two, but this time face up. Rank of the last cards is compared and the higher rank wins. In this game we ommit case of multiple war. The game continues until one of the players remain without a cards.

How to run the game

  1. Select the code editor of your choice (I use Visual Studio Code)
  2. Copy the repository to your new catalogue - use `git clone link_to_repository` command
  3. Select interpreter for your version of python
  4. Enter directory with the war.py file inside
  5. Run program with following command: python war.py

About

This is console version of the War card game made as a exercise to practice object oriented programming. The game essentially plays itself in this version and should be treated only as a demonstration of my experience.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages