Skip to content

About

Simulazione multi-agente in Java 21 e JavaFX: agenti con strategie diverse (greedy, aggressiva, casuale) competono per il territorio su una griglia.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Strategy Simulation

A Java-based territory conquest simulation featuring agents with different algorithmic strategies competing on a grid map.

Overview

Three agents expand their territory turn by turn on a grid. Each agent uses a different strategy to decide where to move, resulting in different behaviors and outcomes.

Strategies

  • Greedy — expands towards the most open space, maximizing future growth
  • Aggressive — moves towards the nearest enemy to block their expansion
  • Random — chooses a random free cell each turn (baseline)

Tech Stack

  • Java 21
  • JavaFX 21 (graphical visualization)
  • Gradle (build system)

Design Patterns

  • Strategy Pattern — each agent's behavior is encapsulated in a separate class implementing a common interface, making it easy to add new strategies

How to Run

git clone https://github.com/Purp7ePi3/strategy-simulation.git
cd strategy-simulation
./gradlew run --no-configuration-cache

Project Structure

src/main/java/com/simulation/
├── core/
│   ├── Cell.java         # single grid cell
│   ├── Grid.java         # grid map with neighbor logic
│   └── Simulation.java   # game loop and agent management
├── agents/
│   ├── Strategy.java     # strategy interface
│   ├── Agent.java        # agent with pluggable strategy
│   ├── GreedyStrategy.java
│   ├── AggressiveStrategy.java
│   └── RandomStrategy.java
├── Main.java
└── SimulationApp.java

Future Work

  • Snake-mode: agents move as a snake, coloring cells as they pass
  • True AI agents using reinforcement learning

About

Simulazione multi-agente in Java 21 e JavaFX: agenti con strategie diverse (greedy, aggressiva, casuale) competono per il territorio su una griglia.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages