Skip to content

ENH: Add ZeroResp v5.4.4 and ZeroResp v2 (tournament rev 2.2) - #1496

Open
Evreu1pro wants to merge 13 commits into
Axelrod-Python:devfrom
Evreu1pro:feat/zeroresp-v2
Open

Evreu1pro wants to merge 13 commits into
Axelrod-Python:devfrom
Evreu1pro:feat/zeroresp-v2

Conversation

@Evreu1pro

@Evreu1pro Evreu1pro commented Aug 2, 2026 •

Copy link
Copy Markdown

What

Adds two related adaptive long-memory strategies for the iterated Prisoner's Dilemma:

  1. ZeroResp v5.4.4 — noise ladder (v5.3 basis) plus responsiveness-gated apology and a cycler contour (periods 2–6, noise-tolerant, mirror-guarded). Epoch debt, delayed retaliation, noise-aware forgiveness, opening disambiguation, finite-horizon harvest.
  2. ZeroResp v2 (implementation revision 2.2, tournament candidate) — earlier backbone with early-sharp retaliation, echo-shield / contrition, noise-aware forgive, deadlock break, and smart end-game harvest.

This PR supersedes #1495 (ZeroResp alone). Prefer reviewing this PR.

Use of AI tools

Strategy logic and tests for ZeroResp v5.4.4 were developed with AI assistance (primarily GLM / Z.ai) on top of the pre-existing ZeroResp v5.3 basis. I set the research questions, accepted or rejected each change, and verified behaviour against paired benchmarks. Grok Bot helped with repository/site publishing and CI monitoring, not with core strategy design. I understand and can explain the submitted code. The change is strategy class(es) plus tests (isolated).

Why

ZeroResp v5.4.4 is the current production build from the project package. At 5% channel noise on the full Axelrod library it is the best of our family (seed 42: full-library #2). Classifiers are honest: manipulates_state: True because of optional class-level opponent profiles (switchable off via use_profiles / Features).

External benchmarks (reproducible package)

Full report and site: https://github.com/Evreu1pro/ZeroResp · https://evreu1pro.github.io/ZeroResp/

Setting Result
Full library · 5% noise · seed 42 ZeroResp v5.4.4 #2
Rank stability @ 5% (seeds 42/43/44) #2 / #5 / #11
Cycler contour vs v5.4.2 +0.36 SPT on CyclerCCD (fresh seeds)
ZeroResp v2 Higher League Top-40 · 400×2 · 7 seeds avg rank #2 (documented on package)

How to test

pytest axelrod/tests/strategies/test_zeroresp.py axelrod/tests/strategies/test_zeroresp_v2.py -q

Smoke:

import axelrod as axl
m = axl.Match((axl.ZeroResp(), axl.TitForTat()), turns=100, seed=0)
m.play()
print(m.final_score(), axl.ZeroResp().name)  # "ZeroResp v5.4.4"

Coverage

  • Initial move always C; reset / clone for multi-rep tournaments
  • Noise ladder, responsiveness-gated apology, cycler contour
  • Feature flags / ablation paths
  • ZeroResp v2 early-sharp, echo shield, noise forgive, deadlock, harvest

Changes

Path Role
axelrod/strategies/zeroresp.py ZeroResp v5.4.4
axelrod/strategies/zeroresp_v2.py ZeroResp v2 (rev 2.2)
axelrod/tests/strategies/test_zeroresp*.py TestPlayer suites
_strategies.py / classifiers / docs registration

Breaking

No — additive only. Display name is ZeroResp v5.4.4 (was v5.3 on this branch earlier).

Review notes for maintainers

  • Happy to drop ZeroResp v2 and keep only ZeroResp v5.4.4 if you prefer a single strategy.
  • manipulates_state is True (class-level profiles); set use_profiles=False for a match-local player.
  • Project site + research notebook: https://evreu1pro.github.io/ZeroResp/

Adds an adaptive state-machine strategy with dynamic epochs, a stochastic
retaliation buffer (5 + U{1..10}), and a permanent red-line ban after
systemic defections. Includes unit tests (initial C, buffer queue, red line,
reset), strategy registration, classifier entry, and docs index update.
Adds tests for match-length edge cases, end-game harvest, anti-raider,
hostile live ban, and epoch/red-line close paths. Updates stochastic and
makes_use_of length filter counts after registering ZeroResp.
NumPy 2.x changes scalar repr (np.int64/np.float64) which breaks doctests,
match.scores output, and fingerprint probe string equality under CI.
Tox already pins numpy==1.26.4 for install_deps; package deps were upgrading
to 2.x via numpy>=1.26.4. Constrain the dependency and harden Point creation.
pytest already green (5252 passed, 100% coverage). CI failed on
black --check for test_zeroresp and a few pre-existing modules under
black 26.x. Format those files so tox commands[1] passes.
Ports ZeroRespV2Core: early-sharp retaliation, echo-shield contrition,
one-shot noise forgiveness, deadlock break, plus ZeroResp backbone
(epochs, systemic red line, anti-raider, end-game harvest).

Includes full TestPlayer suite, registration, classifier YAML, and docs.
@drvinceknight drvinceknight mentioned this pull request Aug 4, 2026
@Evreu1pro Evreu1pro changed the title ENH: Add ZeroResp v2 (champion build) and ZeroResp strategies ENH: Add ZeroResp and ZeroResp v2 (tournament rev 2.2) Aug 4, 2026
@Evreu1pro

Copy link
Copy Markdown
Author

Update for maintainers (2026-08-04)

Pushed revision 2.2 of ZeroResp v2 (short adaptive buffer, dual noise-aware forgiveness, smart harvest / grim probe).

CI was already green on the previous commit; this push should re-run the matrix.

Evidence package (algorithm + unit tests + Higher League / deep-validation tables):
https://github.com/Evreu1pro/ZeroResp

Why this is ready for the strategy list

Request: please review when you have bandwidth. If two strategies are too many, I can collapse to a single ZeroResp entry with the 2.2 logic.

Thank you for maintaining Axelrod — happy to address any requested API/doc changes promptly.

@Evreu1pro

Copy link
Copy Markdown
Author

CI fix for revision 2.2 (just pushed)

Addressed the two failures from the previous matrix run:

  1. test_repr — Player.__repr__ appends base_epoch, so the TestPlayer name is now ZeroResp v2: 25 (was ZeroResp v2).
  2. Coverage 99.95% — added targeted tests for smart harvest / grim-probe paths (last-safe D, probe_fired, stochastic probe, non-grim probe window).

What is in this PR (for clarity):

  • ZeroResp — v1 backbone
  • ZeroResp v2 — class API, implementation revision 2.2 (short adaptive buffer, dual noise forgive, smart harvest / grim probe)

Happy to rename the display string to ZeroResp v2.2 if maintainers prefer that in tournament plots.

@drvinceknight

Copy link
Copy Markdown
Member

Can you fix the merge conflicts (#1497 fixed a problem with numpy).

Take numpy>=2.1 from Axelrod-Python#1497 (Fix numpy version). Keep float() cast
in fingerprint point generation for stable probe names across NumPy.
@Evreu1pro

Copy link
Copy Markdown
Author

Thanks @drvinceknight — merge conflicts with dev are resolved.

Took numpy>=2.1 from #1497 and kept the float() cast in fingerprint point generation. CI should re-run on this push.

@Evreu1pro
Evreu1pro marked this pull request as draft October 20, 2026 19:58
Replace the v5.3 strategy with production ZeroResp v5.4.4 (noise ladder
plus responsiveness-gated apology and cycler contour). Strip Russian and
research-diary comments for the Axelrod tree; keep short English
docstrings. Update tests for the new name and v5.4.x branches (100%
coverage locally). Rebuild classifier table for the renamed player.
ZeroRespV2 (rev 2.2) is unchanged.
@Evreu1pro Evreu1pro changed the title ENH: Add ZeroResp and ZeroResp v2 (tournament rev 2.2) ENH: Add ZeroResp v5.4.4 and ZeroResp v2 (tournament rev 2.2) Oct 24, 2026
@Evreu1pro
Evreu1pro marked this pull request as ready for review October 24, 2026 12:01
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