Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add an attrition table row for age gap 2 and a test

Open
#44 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
78/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
testing

Research direction

Read data/rules/rules.ron, docs/design/attrition.md, and the adjacent attrition_age_gap_table_and_late_harrying_bonus test in crates/sim/tests/m5a.rs; also find the loads_repo_data test in the rules crate. Add and verify the gap-2 value, update the pinned test value, bump rules_version, then run the listed data check, tests, just rerecord, and just verify. Done when the data validates, the Charter-versus-Hearth test reads the value from Rules, and required fixtures are re-recorded.

Written by the indexing model from the issue text.

Description

area:rules area:sim good first issue kind:balance

What

This is M5a's good first issue from docs/ROADMAP.md: "Add an attrition table row for age gap 2 and a test."

Attrition damage per pulse depends on the age gap between the territory's owner and the intruder: max(0, owner age - intruder age). data/rules/rules.ron holds the table:

attrition_age_gap_hp: [1, 2],

Row 0 is the same age and row 1 is one age ahead. The last row also covers larger gaps, so today a Charter owner (age 2) against a Hearth intruder (age 0) deals 2, the same as gap 1. Add a third row for gap 2 so that being two ages ahead hurts more. docs/design/attrition.md explains the design.

  • Change only data, in data/rules/rules.ron. The validator requires the table to be non-decreasing, and it names attrition_age_gap_hp[i] when a row breaks that.
  • Add a sim test next to attrition_age_gap_table_and_late_harrying_bonus in crates/sim/tests/m5a.rs: a Charter owner against a Hearth intruder deals the new gap-2 value per pulse. Read the value from Rules the way the other attrition tests do; don't hard-code it.
  • Update the pinned value in the rules crate's loads_repo_data test. That is the one test a data edit is expected to change (data/rules/README.md).

Watch out

  • Bump rules_version. Every RON edit changes rules_hash. Bump rules_version with a one-line reason, run just rerecord, and include the re-recorded fixtures. A fixture whose units never reach a two-age gap keeps its .hash. If a .hash changes, say why in the PR.
  • Overflow. Keep the value under MAX_ATTRITION_HP. sim-cli data-check reports it if not.

How to verify

cargo run -p sim-cli -- data-check data
cargo test -p rules
cargo test -p sim attrition -- --nocapture
just rerecord && just verify

Works on any OS. Comment to claim; the claim lapses after 14 days of silence.


Generated by Claude Code

Dominant language
Rust
Stars
0
Forks
1
Avg merge
1d 7h
Merged PRs (30d)
10

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tonianev/eonmark

All issues in tonianev/eonmark

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.