Skip to content

ilaymar95/CardGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸƒ CardGame – Python OOP & Unit Testing Project

A command-line based card game built with Python, demonstrating solid Object-Oriented Programming principles and test-driven development using unittest.

πŸ“¦ Project Structure

  • card.py – Defines the Card class, representing a single playing card.
  • deck_of_cards.py – Manages the DeckOfCards class, including deck creation, shuffling, and drawing.
  • player.py – Contains the Player class, handling player hands and actions.
  • card_game.py – Main game logic class that simulates a round-based card game between two players.
  • test_*.py – Unit tests for each main component.

πŸš€ Features

  • Fully modular OOP structure (Card, Deck, Player, Game)
  • CLI-based gameplay simulation
  • Randomized deck with shuffling and drawing
  • Robust edge case handling (e.g., empty deck, insufficient cards)
  • 100% unit test coverage for key components
  • TDD development approach using Python’s built-in unittest library

πŸ§ͺ How to Run Tests

python -m unittest discover

πŸ›  Technologies

  • Python 3.x
  • unittest
  • random module
  • Command Line Interface (CLI)

πŸ“š Learning Goals

  • Deepen understanding of class relationships and encapsulation
  • Practice TDD (Test-Driven Development)
  • Handle game logic, state management, and input validation
  • Organize a clean and testable Python codebase

πŸ‘¨β€πŸ’» Author

Ilay Marciano
LinkedIn β€’ GitHub

About

A Python card game project with unit tests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages