tk-codes / uno

UNO - Card Game with Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UNO - Card Game

Coverage Maintainability Rating

v2.0: Rebuilt the core game logic in domain-driven-design.

uno-ui Note: GUI is built merely to try out the core domain logic. It is not suitable for serious game. :)

Instructions

Run Application

Run the main method in the UnoApp class or use the following command in the terminal:

./gradlew run

Run Unit Tests

./gradlew test

Event Storming

event-storming.

Core Domain

The core game logic is built according to official uno rules.

Uno Card

Cards are value objects, i.e. immutable. The following card types are available in Uno:

  • Number Card
  • Skip Action Card
  • Reverse Action Card
  • Draw Two Action Card
  • Wild Color Card
  • Wild Draw Four Card

Initially wild cards don't have a color. When drawn, a new value object is created with the chosen color.

card-uml

Player

Player is an entity which contains a list of hand cards to play.

PlayerRoundIterator manages the players and switches turn as if the players are in a round table.

player-uml

Game

Game is the aggregate which maintains the state of players, draw pile and discard pile as the cards are played.

game-uml

Domain Events

Game aggregate produces domain events using DomainEventPublisher.

Subscribers can register for these events and handle them accordingly.

events-uml

About

UNO - Card Game with Java

License:MIT License


Languages

Language:Java 100.0%