Skip to content

Changes necessary to implement the 1900 variant (Discussion #964) - #1100

Open
UnUovo77 wants to merge 3 commits into
mainfrom
variant1900
Open

Changes necessary to implement the 1900 variant (Discussion #964)#1100
UnUovo77 wants to merge 3 commits into
mainfrom
variant1900

Conversation

@UnUovo77

@UnUovo77 UnUovo77 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

What this PR does

Implements core adjudicator engine changes to support the Baron M. Powell 1900 variant. Adds six directional adjacency parameters, float-based strength resolution, no-support filtering, cut-exception logic, convoyable-capable provinces, generalized emergency measures, and retreat priority — all as configurable schema fields so the variant data file (baron1900.py) can express 1900 rules declaratively.

Checklist

  • This PR does one thing — adjudicator engine structural changes only (no variant data file, no tests, no frontend)
  • For PRs of any significant complexity: I ran /review-pr against this PR in Claude Code and addressed (or responded to) its findings
  • Tests cover the change
  • Screenshots embedded in the PR description for any visual changes (see CLAUDE.md) — N/A, no visual changes

Summary of Changes

Phase Files Key Changes
1 domain.py, serializers.py, variant.schema.yaml Adjacency: army_strength, fleet_strength, convoy_strength, no_support, cut_exception, retreat_priority (directional) + schema
2 types.py, resolution.py Strength fields → float; _get_base_strength() reads edge strength by unit type/convoy
3 resolution.py _matching_attack_supports / _matching_hold_supports filter by adj.no_support
4 resolution.py cut_exception edges only cut support if attacker dislodges (depends on MOVE_STATUS)
5 domain.py, serializers.py, engine.py, convoy.py, options.py, variant.schema.yaml Province.convoyable_capable; engine/convoy/options treat as valid convoy endpoint
6 domain.py, serializers.py, types.py, variant.schema.yaml EmergencyMeasuresConfig, Variant.emergency_measures, modifier, allowed_builds/required_disbands adjustments, BuildLocationIsEmergencyMeasuresSiteCheck
7 engine.py ResolveRetreatBouncesReducer uses retreat_priority (highest wins, ties bounce)
8 variant.schema.yaml All new fields in $defs.Adjacency, $defs.Province, root properties

1900 Rules → Engine Fields

Rule Fields
Suez half-strength fleetStrength: 0.5, convoyStrength: 0.5 on Suez edges
Suez no-support noSupport: true on Suez edges
Suez cut-exception cutException: true on Suez edges
Suez convoy asymmetry Directional convoyStrength per edge
Suez retreat priority retreatPriority: 0 (direct), -1 (Africa)
Gibraltar convoyable convoyableCapable: true + pass: army edge
Russian EMR emergencyMeasures.russia config

Files Modified

  • service/adjudicator/domain.py — new Adjacency/Province fields, EmergencyMeasuresConfig, Variant.emergency_measures
  • service/adjudicator/serializers.py — deserialization of all new fields
  • service/adjudicator/types.py — float strengths, EMERGENCY_MEASURES modifier, NationView EMR helpers, BuildLocationIsEmergencyMeasuresSiteCheck
  • service/adjudicator/resolution.py_get_base_strength, no-support filtering, cut-exception logic
  • service/adjudicator/engine.py — MarkConvoyedMovesReachableReducer, ResolveRetreatBouncesReducer
  • service/adjudicator/convoy.py_sea_neighbours includes convoyable_capable
  • service/adjudicator/options.py — convoy endpoint checks use convoyable_capable
  • service/variant.schema.yaml — all new schema fields

@netlify

netlify Bot commented Jul 26, 2026

Copy link
Copy Markdown

Deploy Preview for diplicity-variant-creator canceled.

Name Link
🔨 Latest commit e2b6636
🔍 Latest deploy log https://app.netlify.com/projects/diplicity-variant-creator/deploys/6a6632bea9f2e100072223f1

@github-actions

Copy link
Copy Markdown
Contributor

Warning

WIP limit exceeded. There are now 11 open pull requests — the project target is 5 or fewer.

Please close or merge an existing PR before continuing with this one.

Comment on lines +122 to +124
extraBuildSite:
type: string
description: Province ID that becomes a build site when EMR is active.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a concept called pre-processors and post-processors that are intended to be used for unusual rules, but I'm not sure how much they have been used much yet.

Here's how they are meant to work

GameState -> PreProcessor -> ModifiedGameState -> Adjudicator -> PostProcessor -> GameState

Basically, for a lot of rules, we could achieve the rule by just modifying the game state temporarily during adjudication.

A pre-processor and post-processor can be written for individual variants.

So, for extraBuildSite, we could actually just promote the relevant province to have a supply center during adjudication, and then revert to normal after processing.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a pre-processor and post-processor combination I think we could remove homeCenters, extraBuildSite, minOwnedHome and maxOwnedHome from the schema here.

examples:
- ["allow-builds-in-non-home-centers"]

emergencyMeasures:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally speaking we don't want to include rules for one specific variant in the core variant schema. That's what pre-processors, post-processors and adjudication modifiers are for

nation's home center even after another nation captures it, and
`homeNation` reflects the home-center designation, not current
ownership.
convoyableCapable:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think canConvoy might be a better name

provinces that don't share a coast)
- fleet: fleet-only (sea-to-sea or sea-to-coastal)
- both: shared coast / either type can pass
armyStrength:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are lots of new properties here. I think we need to think if any of them can be represented using modifiers or pre/post processors. I'll have a think

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.

2 participants