2025‑04‑19 Report
Overview
Today we completed a major refactoring of the core engine modules (play/
and cards/
), introduced a robust macro‑driven effects registry, and achieved full test coverage across both subsystems.
Key Accomplishments
-
Types Templating
-
Defined
CardTemplate(name, cost, type, data)
as the single canonical representation for all cards. - Added convenience constructors:
Treasure(name; cost, coin_gain)
Victory(name; cost, vp)
Action(name; cost; kwargs...)
-
Exposed
card_info
to merge or isolate rawdata
fields into aNamedTuple
. -
Player Module (
play/
) -
Redesigned
State
struct: addedplayed
pile, reordered fields to “noun first,” and adhered to “module‑prefix” naming. new(deck_starting; deck_shuffle=true)
supports optional shuffle.-
Provided simple getters:
deck_size
,hand_size
,played_size
,discard_size
. -
Effects Framework
-
Macro registration:
@register :sym fn
registers an effect at compile time, warning on overwrite. - Dispatcher:
dispatch(card, player, game; args=nothing)
- Reads
card.data[:effects]
symbols - Looks up each effect via
Registry.get
(now usingBase.get
to avoid recursion) - Supplies either the keyed value from
card.data
or the fallbackargs
.
- Reads
-
Improved parameter passing by using keyword args and per‑effect defaults.
-
Cards Module (
cards/
) -
Simplified
Registry
:Dict{Symbol,CardTemplate}
withset!
/get
/exists
/list_cards
. - Centralized macro
@register :Name expr
incards.jl
—no per‑fileusing
needed. -
Enhanced
SetsLoader.sets_load!(; sets, cards)
to support both set‑level and card‑level filtering, matching filenames in lowercase to symbol inputs. -
Testing & Coverage
- Play tests (
test_play.jl
): coversTypes
,Player
,Effects
, and macro registry without any dependency onCards
. - Cards tests (
test_cards.jl
): coversRegistry
API,@register
macro, andSetsLoader
behavior. - Result: 6 modules, 19 tests, 100% passing.
Next Steps
- Refactor
game/
module - Design global game state (supply piles, trash, turn phases).
-
Implement turn flow: Action → Buy → Cleanup.
-
Enhance Effects DSL
- Support conditional and composite effects.
-
Consider a mini‑DSL or additional macros for complex card logic.
-
Documentation & Reporting
- Update
reports.md
withgame/
design diagrams. -
Add usage examples and a quick‑start guide.
-
CI & Quality Metrics
- Configure GitHub Actions to run tests and publish coverage.
- Automate daily report generation and badge updates.
Conclusion
The foundation for card definitions, player state, and effect dispatching is now rock solid and fully tested. Tomorrow we’ll extend this core into a full game loop and start wiring up actual gameplay.