Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 157 additions & 0 deletions Arch_Description/ClassDiag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
@startuml

package Core {
class GameMenu {
-Game game
+void showMainMenu()
+void selectGameMode(GameMode mode)
+void startGame()
}

class Game {
-Player player1
-Player player2
-GameField field
-boolean gameActive
-GameMode currentMode
+void startGame()
+void endTurn()
+void checkWinCondition()
+void processCardReplacement()
+void setGameMode(GameMode mode)
}

class GameField {
-List<Card> player1Cards
-List<Card> player2Cards
-boolean commanderHornActive
-boolean bitingFrostActive
+void calculateScores()
+void clearWeatherEffects()
+int getPlayer1Score()
+int getPlayer2Score()
}
}

package Players {
abstract class Player {
-String name
-Hand hand
-Deck deck
-boolean hasPassed
+void drawCard()
+void playCard(Card card)
+void pass()
+void autoPassIfNoCards()
+void replaceCards(List<Card> cardsToReplace)
+boolean getHasPassed()
+String getName()
+Hand getHand()
+Deck getDeck()
}

class HumanPlayer {
+void selectCard()
+void decidePass()
}

class AIPlayer {
+Card chooseCardToPlay()
+boolean decideIfPass()
+List<Card> chooseCardsToReplace()
}
}

package Cards {
abstract class Card {
-String name
-int baseStrength
+void play(GameField field)
+String getName()
+int getBaseStrength()
}

package Creatures {
class CroneWhispess
class CroneWeavess
class CroneBrewess
class Catapult
class SiegeExpert
class BlueStripesCommando
class CloseCombat
class Archer
}

package Spells {
class CommanderHorn
class BitingFrost
class ClearSky
}
}

package Utilities {
class Deck {
-List<Card> cards
+void shuffle()
+Card drawCard()
+void initializeDeck()
+List<Card> drawDifferentCards(int count, List<Card> excluded)
}

class Hand {
-List<Card> cards
+void addCard(Card card)
+void removeCard(Card card)
+List<Card> getCards()
+int getSize()
}
}

package Display {
class GameRenderer {
+void renderMainMenu()
+void renderGameModeSelection()
+void renderGameField(GameField field)
+void renderHand(Hand hand, boolean isHuman)
+void renderScores(int player1Score, int player2Score)
+void renderPassStatus(boolean humanPassed, boolean aiPassed)
+void renderCardReplacementInterface(Hand hand)
}
}

enum GameMode {
HUMAN_VS_HUMAN
HUMAN_VS_AI
}

Player <|-- HumanPlayer
Player <|-- AIPlayer

Card <|-- CroneWhispess
Card <|-- CroneWeavess
Card <|-- CroneBrewess
Card <|-- Catapult
Card <|-- SiegeExpert
Card <|-- BlueStripesCommando
Card <|-- CloseCombat
Card <|-- Archer
Card <|-- CommanderHorn
Card <|-- BitingFrost
Card <|-- ClearSky

GameMenu --> Game : creates
Game *-- Player
Game *-- GameField
Player *-- Hand
Player *-- Deck
GameField o-- Card
Deck o-- Card
Hand o-- Card

Game --> GameRenderer : uses
GameRenderer --> GameMenu : displays
AIPlayer --> Card : chooses
HumanPlayer --> Card : selects
GameMenu --> GameMode : uses
Game --> GameMode : has
@enduml
36 changes: 36 additions & 0 deletions Arch_Description/CompDiag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@startuml

package Core {
[GameMenu]
[Game]
[GameField]
}

package Players {
[HumanPlayer]
[AIPlayer]
}

package Cards {
[Deck]
[Hand]
[Card]
}

package Display {
[GameRenderer]
}

GameMenu --> Game : starts
Game --> HumanPlayer : manages
Game --> AIPlayer : manages
Game --> GameField : uses
Game --> Deck : uses
Game --> Hand : uses
Game --> GameRenderer : updates
GameRenderer --> GameMenu : displays
GameRenderer --> HumanPlayer : interacts
Hand --> Card : contains
Deck --> Card : contains
GameField --> Card : contains
@enduml
74 changes: 74 additions & 0 deletions Arch_Description/projDescription.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Simplified Gwent Project Architecture

## Overview
A simplified card game for two players with single round. Supports two game modes: Human vs Human and Human vs AI. Players can voluntarily stop playing cards before playing all cards in their hand.

## Deck Composition
Each player has an identical deck of 11 unique cards:

### **Creatures (8 cards)**
- CroneWhispess - strength 6
- CroneWeavess - strength 6
- CroneBrewess - strength 6
- Catapult - strength 8
- SiegeExpert - strength 6
- BlueStripesCommando - strength 4
- CloseCombat - strength 5
- Archer - strength 4

### **Spells (3 cards)**
- CommanderHorn - doubles creature strength
- BitingFrost - sets all creature strength to 1
- ClearSky - removes BitingFrost effect

## Game Flow

### **Initial Phase**
1. Each player receives 7 random cards from their deck
2. Players can replace up to 2 cards:
- Return selected cards to the deck
- Receive **different random cards from the deck** (not the same ones)

### **Main Phase**
- Players take turns playing one card at a time
- Player can declare pass on their turn
- After declaring pass, player cannot play more cards this round
- If player has no cards left, they are automatically considered passed
- Round ends when both players have passed

### **Completion**
- Score calculation considering active effects
- Player with higher total strength wins

## Class Responsibilities by Package

### **Core Package**
- **GameMenu** - manages game mode selection and main menu
- **Game** - manages game flow, tracks player pass states and game mode
- **GameField** - calculates current scores considering active effects

### **Players Package**
- **Player** - base class with pass state management
- **HumanPlayer** - handles human input for card selection and passing
- **AIPlayer** - contains AI logic for card selection and pass decisions

### **Cards Package**
All cards store only base strength. Effects are calculated dynamically during score calculation.

### **Utilities Package**
- **Deck** - manages deck operations and card replacement
- **Hand** - manages player's hand cards

### **Display Package**
- **GameRenderer** - renders game interface, menu, and game state

## Effect Logic
- **CommanderHorn**: creature strength doubles
- **BitingFrost**: all creature strength set to 1
- **CommanderHorn + BitingFrost**: all creature strength set to 2
- **ClearSky**: cancels BitingFrost effect only

## Pass Strategy
- **HumanPlayer**: can voluntarily declare pass through interface
- **AIPlayer**: makes pass decision based on game state analysis
- **Automatic**: player automatically passes when no cards remain
110 changes: 110 additions & 0 deletions Arch_Description/systemRequirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# System Requirements and Use Cases (Final Version)

## English Version

### System Requirements

#### Functional Requirements
1. **Game Mode Selection**
- The system shall provide a menu for selecting game mode: Human vs Human or Human vs AI
- The system shall initialize the appropriate player types based on selected mode

2. **Game Initialization**
- The system shall create two identical decks of 11 unique cards for each player
- The system shall deal 7 random cards to each player at game start
- The system shall allow each player to replace up to 2 cards with different random cards from their deck

3. **Game Flow**
- The system shall enforce turn-based gameplay between two human players or human and AI player
- The system shall allow players to either play a card or pass on their turn
- The system shall prevent players who have passed from playing additional cards
- The system shall automatically mark a player as passed when they have no cards left
- The system shall end the round when both players have passed

4. **Card Effects**
- The system shall apply CommanderHorn effect: double the strength of all creatures
- The system shall apply BitingFrost effect: set strength of all creatures to 1
- The system shall apply ClearSky effect: remove BitingFrost effect
- The system shall handle effect combination: CommanderHorn + BitingFrost = strength 2 for all creatures

5. **Victory Condition**
- The system shall calculate final scores considering active effects
- The system shall declare the player with higher total strength as winner

6. **Card Immutability**
- All card classes shall be immutable after creation
- Card properties (name, baseStrength) shall not be modifiable after object construction
- Card objects shall be reusable across multiple game sessions
- Card effects shall be applied through new object creation or external state management

### Use Cases

#### Use Case 0: Select Game Mode
**Actor:** Human Player
**Preconditions:** Application started
**Main Flow:**
1. System displays game mode selection menu
2. Player selects between "Human vs Human" and "Human vs AI"
3. System initializes the game with selected mode
4. System proceeds to initial card replacement phase

#### Use Case 1: Initial Card Replacement
**Actor:** Human Player (both players in Human vs Human mode)
**Preconditions:** Game mode selected, game has started, player has 7 cards
**Main Flow:**
1. System displays hand of 7 cards
2. Player selects up to 2 cards to replace
3. System removes selected cards from player's hand
4. System adds different random cards from deck to player's hand
5. System continues to main game phase

**Alternative Flow:**
- Player chooses to replace 0 cards → proceed directly to main game phase

#### Use Case 2: Play Creature Card
**Actor:** Current Player (Human or AI)
**Preconditions:** Player's turn, player has not passed, hand contains cards
**Main Flow:**
1. Player selects creature card from hand
2. System moves card from hand to game field
3. System recalculates current scores
4. System passes turn to next player

**Postconditions:** Card is on field, scores updated, turn changed

#### Use Case 3: Play Spell Card
**Actor:** Current Player (Human or AI)
**Preconditions:** Player's turn, player has not passed, hand contains spell card
**Main Flow:**
1. Player selects spell card from hand
2. System applies spell effect according to rules
3. System removes card from hand
4. System recalculates current scores
5. System passes turn to next player

#### Use Case 4: Player Pass
**Actor:** Current Player (Human or AI)
**Preconditions:** Player's turn, player has not passed
**Main Flow:**
1. Player selects pass option
2. System marks player as having passed
3. System passes turn to other player
4. If both players have passed, system proceeds to end game

#### Use Case 5: AI Turn
**Actor:** AI Player
**Preconditions:** AI player's turn, AI has not passed
**Main Flow:**
1. System evaluates game state
2. AI decides to play card or pass based on strategy
3. If playing card, system automatically plays selected card
4. If passing, system marks AI as having passed
5. System updates game state and passes turn

#### Use Case 6: Player Runs Out of Cards
**Actor:** Current Player (Human or AI)
**Preconditions:** Player's turn, player has no cards in hand, player has not passed
**Main Flow:**
1. System automatically marks player as having passed
2. System passes turn to other player
3. If both players have passed, system proceeds to end game
Loading