Skip to content

Add a reusable headless simulation and terminal module - #11627

Draft
rrnewton wants to merge 1 commit into
Card-Forge:masterfrom
rrnewton:rrn-headless-rebased
Draft

Add a reusable headless simulation and terminal module#11627
rrnewton wants to merge 1 commit into
Card-Forge:masterfrom
rrnewton:rrn-headless-rebased

Conversation

@rrnewton

Copy link
Copy Markdown

Summary

This extracts match simulation from the desktop application into a new forge-headless Maven module. The desktop entry point remains as a deprecated compatibility facade. The module can run normal Forge AI simulations, a terminal-controlled game, or a lightweight random controller intended for throughput benchmarks.

This pull request contains no DeepScry bridge or foreign-agent protocol code. That integration remains on a separate downstream branch.

Behavior preserved and added

  • preserves the current simulator seed option and per-player AI-profile option
  • accepts both relative and absolute deck file paths
  • provides a repository-level headless.sh launcher
  • provides pass, random, zero-choice, and terminal controller implementations
  • keeps desktop callers working through forge.view.SimulateMatch

The random controller intentionally chooses only from its supported legal-action subset and skips spells that require targets. It is a benchmark/load controller, not an alternative strategic AI. Tournament mode continues to use normal Forge AI; combining tournament mode or AI profiles with random-controller mode fails with a clear message.

Tests

  • mvn -pl forge-headless -am test: 3 Forge game tests and 8 headless tests passed; 0 failures
  • mvn -pl forge-headless -am package -DskipTests: passed
  • two seeded two-game simulations produced the same normalized SHA-256 output
  • a seeded random-controller simulation completed with a winner

Reviewer notes

The largest file is the terminal controller. It mirrors the breadth of Forge controller callbacks so terminal games can answer choices without a graphical interface. The simulation extraction and terminal mode are in the same module because they share the headless GUI implementation and game bootstrap, but neither changes core game rules.

Extract the desktop simulator into a reusable headless Maven module, retain the desktop compatibility facade, and provide terminal, random, and zero controllers. Preserve current upstream seed and AI-profile options while fixing direct file-path deck loading.

Test Results Summary:
- mvn -pl forge-headless -am test: 11 tests passed (3 forge-game, 8 forge-headless), 0 failed
- packaged headless assembly successfully
- seeded two-game simulation repeated with identical normalized SHA-256 output
- random-controller launcher smoke completed with a winner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant