refactor(engine): deduplicate TABLEAU_FAN_FRAC constant shared between layout.rs and card_plugin.rs #59

Open
opened 2026-05-28 01:50:33 +00:00 by funman300 · 0 comments
Owner

Problem

TABLEAU_FAN_FRAC = 0.18 is defined in two places:

  • solitaire_engine/src/layout.rs (line 78)
  • solitaire_engine/src/card_plugin.rs (line 46, with a comment saying the two values must stay in sync)

Requiring manual synchronisation of the same constant is fragile — they will inevitably drift.

Fix

Define TABLEAU_FAN_FRAC once in layout.rs (or a shared constants.rs) and import it in card_plugin.rs:

// card_plugin.rs
use crate::layout::TABLEAU_FAN_FRAC;

Remove the duplicate definition and the sync-comment.

## Problem `TABLEAU_FAN_FRAC = 0.18` is defined in two places: - `solitaire_engine/src/layout.rs` (line 78) - `solitaire_engine/src/card_plugin.rs` (line 46, with a comment saying the two values *must stay in sync*) Requiring manual synchronisation of the same constant is fragile — they will inevitably drift. ## Fix Define `TABLEAU_FAN_FRAC` once in `layout.rs` (or a shared `constants.rs`) and import it in `card_plugin.rs`: ```rust // card_plugin.rs use crate::layout::TABLEAU_FAN_FRAC; ``` Remove the duplicate definition and the sync-comment.
funman300 added the correctness label 2026-05-28 01:50:33 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#59