Skip to content

About

Football Simulator created for Programming Paradigms

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Football Simulator (FootballSim)

A comprehensive Java-based football league management and simulation game that allows players to manage football clubs, simulate matches, and track season statistics.

📋 Project Information

  • Author: Leandro de Almeida Glórias Afonso
  • Student Number: 8220302
  • Class: LSIRC T1
  • Language: Java 21
  • Build Tool: Maven

🎮 Features

Core Functionality

  • Club Management: Manage football clubs with detailed player rosters
  • Match Simulation: Realistic football match simulation with events, goals, and statistics
  • Season Management: Complete season simulation with schedules and standings
  • Player Statistics: Track individual player performance and goal statistics
  • Formation System: Multiple tactical formations (4-4-2, 4-3-3, 5-3-2, 3-5-2)
  • Interactive UI: Console-based user interface for game interaction

Technical Features

  • Data Import/Export: JSON-based data management for clubs, players, and game state
  • HTML Generation: Automated HTML report generation for seasons, matches, and clubs
  • Event System: Comprehensive match event tracking (goals, fouls, cards, etc.)
  • Flexible Architecture: Modular design with clear separation of concerns

🏗️ Project Structure

src/main/java/pt/estg/lsirc/footballsim/
├── Main.java                           # Application entry point
├── game/                               # Game orchestration
│   ├── FootballManagerGame.java        # Main game controller
│   ├── UIManager.java                  # User interface management
│   └── PlayerGoalStat.java            # Player statistics tracking
├── impl/                               # Core implementations
│   ├── data/                          # Data handling
│   │   ├── JsonDataImporter.java      # JSON data loading
│   │   └── ExporterHelper.java        # Data export utilities
│   ├── event/                         # Match events
│   │   ├── EventImpl.java             # Base event implementation
│   │   ├── GoalEventImpl.java         # Goal-specific events
│   │   ├── EventManagerImpl.java      # Event management
│   │   └── EventType.java             # Event type definitions
│   ├── league/                        # League management
│   │   ├── LeagueImpl.java            # League implementation
│   │   ├── SeasonImpl.java            # Season management
│   │   ├── ScheduleImpl.java          # Match scheduling
│   │   └── StandingImpl.java          # League standings
│   ├── match/                         # Match simulation
│   │   └── MatchImpl.java             # Match implementation
│   ├── player/                        # Player management
│   │   ├── PlayerImpl.java            # Player implementation
│   │   ├── PlayerPositionImpl.java    # Position management
│   │   └── PlayerPositionType.java    # Position types
│   ├── simulation/                    # Game simulation
│   │   └── DefaultMatchSimulatorStrategy.java
│   └── team/                          # Team management
│       ├── ClubImpl.java              # Club implementation
│       ├── TeamImpl.java              # Team implementation
│       ├── FormationImpl.java         # Formation system
│       └── FormationType.java         # Formation types
└── util/                              # Utility classes
    └── ArrayUtils.java                # Array manipulation helpers

🚀 Getting Started

Prerequisites

  • Java 21 or higher
  • Maven 3.6 or higher

Installation

  1. Clone the repository

    git clone <repository-url>
    cd PP_8220302
  2. Quick Start (Recommended)

    # For Linux/macOS
    ./run.sh
    
    # For Windows
    run.bat
    
    # Using Make (if available)
    make run
  3. Manual Build and Run

    # Build the project
    mvn clean compile
    
    # Run the application
    mvn exec:java
    
    # Or run the main class directly
    java -cp target/classes pt.estg.lsirc.footballsim.Main
  4. Create Distributable JAR

    mvn package
    java -jar target/footballsim.jar

Maven Commands

  • Compile: mvn compile
  • Run: mvn exec:java
  • Generate JavaDoc: mvn javadoc:javadoc
  • Clean: mvn clean
  • Package: mvn package

📊 Game Data

The game includes sample data for Portuguese football clubs:

Clubs

  • Sport Lisboa e Benfica (SLB) - Founded 1904, Estádio da Luz
  • Futebol Clube do Porto (FCP) - Founded 1893, Estádio do Dragão

Data Files

  • src/main/resources/files/clubs.json - Club definitions
  • src/main/resources/files/players/Benfica.json - Benfica player roster
  • src/main/resources/files/players/Porto.json - Porto player roster

🎯 How to Play

  1. Start the Game: Run the main class to begin
  2. Club Selection: The system automatically assigns you a club to manage
  3. Season Management: Navigate through menu options to:
    • View your squad and player details
    • Check the season schedule
    • Prepare for upcoming matches
    • Simulate match rounds
    • View league standings and statistics
  4. Match Simulation: Watch realistic match simulations with detailed events
  5. Statistics: Track player goals, team performance, and league standings

🏛️ Architecture

The project follows a layered architecture pattern:

  • Game Layer: High-level game orchestration and UI
  • Implementation Layer: Core business logic implementations
  • Utility Layer: Helper classes and utilities
  • Contracts Layer: External API contracts (from apicontracts dependency)

Key Design Patterns

  • Strategy Pattern: Match simulation strategies
  • Factory Pattern: Object creation and initialization
  • Observer Pattern: Event management system
  • MVC Pattern: Clear separation of model, view, and controller

📚 Dependencies

  • JSON Processing: org.json:json:20250517
  • Jackson Core: com.fasterxml.jackson.core:jackson-*:2.15.2
  • API Contracts: com.ppstudios.footballmanager.api.contracts:apicontracts:1.0-SNAPSHOT

📖 Documentation

Comprehensive JavaDoc documentation is available in the javadoc/ directory. Open javadoc/index.html in a web browser to browse the full API documentation.

🔧 Configuration

The application uses several configuration files:

  • Maven Configuration: pom.xml
  • Club Data: src/main/resources/files/clubs.json
  • Player Data: src/main/resources/files/players/*.json

🎨 HTML Generation

The game can generate HTML reports for:

  • Season summaries and standings
  • Individual match reports
  • Club profiles and statistics
  • League overviews

Generated HTML files appear in the project root directory.

🚨 Error Handling

The application includes comprehensive error handling for:

  • Data loading failures
  • Invalid game states
  • File I/O operations
  • Match simulation errors

Critical errors will cause graceful application shutdown with informative error messages.

About

Football Simulator created for Programming Paradigms

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages