How wilsoncespedes-dot/ajedrez works
Purpose and execution
ModeladorAjedrez is a Java/Maven chess-domain model split into logical microservice-ready bounded contexts. It currently runs in one JVM; no HTTP servers, persistence layer, or deployed infrastructure exist. The Maven aggregator is ModeladorAjedrez/pom.xml; the console demo entry point is ModeladorAjedrez/partida-service/src/main/java/ajedrez/partida/Main.java. A separate browser-only visualizer is ModeladorAjedrez/interfaz-web/index.html.
Module boundaries
Each Maven module produces its own JAR and exposes a public XxxService facade. Dependencies are directional: board → movement rules → game orchestration.
• Board state: ModeladorAjedrez/tablero-service/pom.xml
• Movement rules depend on board: ModeladorAjedrez/movimientos-service/pom.xml
• Game orchestration depends on both: ModeladorAjedrez/partida-service/pom.xml
The intended future deployment seam is an HTTP adapter around each facade, without moving domain logic.
Board-state authority
tablero-service exclusively owns board contents and mutation. Tablero is the mutable implementation, while other modules consume the read-only EstadoTablero contract, preventing rules code from changing positions directly.
Core model paths:
• ModeladorAjedrez/tablero-service/src/main/java/ajedrez/tablero/Tablero.java
• ModeladorAjedrez/tablero-service/src/main/java/ajedrez/tablero/EstadoTablero.java
• ModeladorAjedrez/tablero-service/src/main/java/ajedrez/tablero/TableroService.java
Pieza, Posicion, and Color form the shared board-domain representation within this bounded context.
Movement-rule engine
movimientos-service evaluates legal destination squares from a supplied EstadoTablero; it does not execute moves. CalculadorMovimientos defines the per-piece rule contract, implemented by piece-specific calculators such as pawn, rook, knight, bishop, queen, and king.
Core paths:
• ModeladorAjedrez/movimientos-service/src/main/java/ajedrez/movimientos/CalculadorMovimientos.java
• ModeladorAjedrez/movimientos-service/src/main/java/ajedrez/movimientos/MovimientosService.java
• ModeladorAjedrez/movimientos-service/src/main/java/ajedrez/movimientos/Reina.java
This boundary supports rule evaluation against a board snapshot/read interface and keeps mutation centralized.
Game orchestration and flow
partida-service is the only context that coordinates board and movement services. Its primary flow is: validate/current-turn context → request possible moves from MovimientosService against board state → execute an approved move through TableroService → determine capture → record Jugada → switch turn.
Core paths:
• ModeladorAjedrez/partida-service/src/main/java/ajedrez/partida/PartidaService.java
• ModeladorAjedrez/partida-service/src/main/java/ajedrez/partida/Jugada.java
• ModeladorAjedrez/partida-service/src/main/java/ajedrez/partida/Main.java
It owns business-level state such as turn, move history, and captures; neither lower module should own that orchestration.
User interfaces and external boundaries
The console demo drives the Java model in-process. The independent HTML UI reimplements the movement rules in JavaScript and therefore does not call Java modules or any backend:
• ModeladorAjedrez/interfaz-web/index.html
There are no current external services, databases, message brokers, containers, or HTTP APIs. A future browser/backend boundary should target PartidaService as the business-facing API, while preserving TableroService and MovimientosService as internal or independently deployable service facades.
Main entry points: MovimientosService.java MovimientosService · PartidaService.java PartidaService · Tablero.java Tablero · TableroService.java TableroService
Components 11
Board state
Exclusive owner of board contents and mutation.
- TableroService · Public mutation-facing board service.
ModeladorAjedrez/tablero-service/src/main/java/ajedrez/tablero/TableroService.java - Tablero · Authoritative mutable board implementation.
ModeladorAjedrez/tablero-service/src/main/java/ajedrez/tablero/Tablero.java - EstadoTablero · Read-only board view consumed by rules.
ModeladorAjedrez/tablero-service/src/main/java/ajedrez/tablero/EstadoTablero.java - Pieza · Posicion · Color
Movement rules
Read-only legal-move evaluation.
- MovimientosService · Returns legal destinations without executing moves.
ModeladorAjedrez/movimientos-service/src/main/java/ajedrez/movimientos/MovimientosService.java - CalculadorMovimientos · Per-piece legal-move calculator contract.
ModeladorAjedrez/movimientos-service/src/main/java/ajedrez/movimientos/CalculadorMovimientos.java - Reina calculator · Example piece-specific calculator implementation.
ModeladorAjedrez/movimientos-service/src/main/java/ajedrez/movimientos/Reina.java
Game orchestration
Coordinates turns, moves, captures, and history.
- PartidaService · Business-facing coordinator for game flow.
ModeladorAjedrez/partida-service/src/main/java/ajedrez/partida/PartidaService.java - Jugada · Records approved moves in game history.
ModeladorAjedrez/partida-service/src/main/java/ajedrez/partida/Jugada.java
User interfaces
- Console demo · In-process demonstration entry point.
ModeladorAjedrez/partida-service/src/main/java/ajedrez/partida/Main.java - Browser visualizer · Reimplements movement rules in JavaScript; does not call Java.
ModeladorAjedrez/interfaz-web/index.html
Connections 11
- TableroService → Tablero: mutates
- Tablero → EstadoTablero: exposes read view
- Tablero → Pieza · Posicion · Color: stores
- MovimientosService → CalculadorMovimientos: delegates rules
- CalculadorMovimientos → Reina calculator: implemented by
- MovimientosService → EstadoTablero: reads board state
- MovimientosService → Pieza · Posicion · Color: evaluates pieces and positions
- PartidaService → MovimientosService: requests possible moves
- PartidaService → TableroService: executes approved move
- PartidaService → Jugada: records move and capture
- Console demo → PartidaService: drives in-process