Changes necessary to implement the 1900 variant (Discussion #964) - #1100
Changes necessary to implement the 1900 variant (Discussion #964)#1100UnUovo77 wants to merge 3 commits into
Conversation
✅ Deploy Preview for diplicity-variant-creator canceled.
|
|
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. |
| extraBuildSite: | ||
| type: string | ||
| description: Province ID that becomes a build site when EMR is active. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
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
/review-pragainst this PR in Claude Code and addressed (or responded to) its findingsSummary of Changes
domain.py,serializers.py,variant.schema.yamlarmy_strength,fleet_strength,convoy_strength,no_support,cut_exception,retreat_priority(directional) + schematypes.py,resolution.pyfloat;_get_base_strength()reads edge strength by unit type/convoyresolution.py_matching_attack_supports/_matching_hold_supportsfilter byadj.no_supportresolution.pycut_exceptionedges only cut support if attacker dislodges (depends onMOVE_STATUS)domain.py,serializers.py,engine.py,convoy.py,options.py,variant.schema.yamlProvince.convoyable_capable; engine/convoy/options treat as valid convoy endpointdomain.py,serializers.py,types.py,variant.schema.yamlEmergencyMeasuresConfig,Variant.emergency_measures, modifier,allowed_builds/required_disbandsadjustments,BuildLocationIsEmergencyMeasuresSiteCheckengine.pyResolveRetreatBouncesReducerusesretreat_priority(highest wins, ties bounce)variant.schema.yaml$defs.Adjacency,$defs.Province, root properties1900 Rules → Engine Fields
fleetStrength: 0.5,convoyStrength: 0.5on Suez edgesnoSupport: trueon Suez edgescutException: trueon Suez edgesconvoyStrengthper edgeretreatPriority: 0(direct),-1(Africa)convoyableCapable: true+pass: armyedgeemergencyMeasures.russiaconfigFiles Modified
service/adjudicator/domain.py— new Adjacency/Province fields, EmergencyMeasuresConfig, Variant.emergency_measuresservice/adjudicator/serializers.py— deserialization of all new fieldsservice/adjudicator/types.py— float strengths, EMERGENCY_MEASURES modifier, NationView EMR helpers, BuildLocationIsEmergencyMeasuresSiteCheckservice/adjudicator/resolution.py—_get_base_strength, no-support filtering, cut-exception logicservice/adjudicator/engine.py— MarkConvoyedMovesReachableReducer, ResolveRetreatBouncesReducerservice/adjudicator/convoy.py—_sea_neighboursincludes convoyable_capableservice/adjudicator/options.py— convoy endpoint checks use convoyable_capableservice/variant.schema.yaml— all new schema fields