Skip to content

Object-oriented design: The game is implemented using classes and objects, making it modular.

License

Notifications You must be signed in to change notification settings

yuvalavr24/cardgame-python-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

War Card Game 🃏

Welcome to the War Card Game repository! This Python program allows you to play the classic card game of War, where players compete to win all the cards in the deck.

Overview

War (also known as Battle in the United Kingdom) is a simple card game typically played by two players using a standard playing card deck. The objective of the game is to win all of the cards. In this implementation, the player with the higher number of cards at the end of 10 rounds is declared the winner.

How to Play

To play the game, follow these steps:

  • Run the main Python program main.py.
  • Enter the names of the two players.
  • View the cards dealt to each player.
  • Watch as the game progresses through 10 rounds.
  • At the end of the game, the winner will be declared.

Features

Object-oriented design: The game is implemented using classes and objects, making it modular and easy to understand. Customizable: Players can enter their names and initial number of cards. Interactive: The game prints out the moves and waits between rounds to build tension. Unit tests: The program includes unit tests to ensure the correctness of the classes.

Requirements

Python 3.x No additional libraries or dependencies required, except for the standard random module.

How to Run

To run the game, simply download or clone the entire project directory onto your local machine. Then, navigate to the project directory in your terminal or command prompt and execute the main.py file using Python:

python3 main.py

Unit Tests

If you're using PyCharm, you can run unit tests directly from the PyCharm interface instead of using terminal commands:

  • Open your PyCharm project.
  • Navigate to the test file in the Project tool window.
  • Right-click on the test file and select "Run Test-Name" or "Run Test-Name with Coverage" from the context menu.
  • PyCharm will execute the unit tests and display the results in the "Run" tool window.

By running the tests through PyCharm, you can take advantage of its features such as test result visualization, debugging, and coverage analysis.

Contributions

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Object-oriented design: The game is implemented using classes and objects, making it modular.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages