A Java-based territory conquest simulation featuring agents with different algorithmic strategies competing on a grid map.
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.
- 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)
- Java 21
- JavaFX 21 (graphical visualization)
- Gradle (build system)
- Strategy Pattern — each agent's behavior is encapsulated in a separate class implementing a common interface, making it easy to add new strategies
git clone https://github.com/Purp7ePi3/strategy-simulation.git
cd strategy-simulation
./gradlew run --no-configuration-cachesrc/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
- Snake-mode: agents move as a snake, coloring cells as they pass
- True AI agents using reinforcement learning