For the BoyleSports software prompt, model settlement as a transparent calculation over recorded leg outcomes. Start with a test matrix and money representation before adding the complexity of different wager types.
What to prepare for BoyleSports
BoyleSports' support documentation distinguishes lost and void results. The contract below is a fictional coding exercise. Confirm the supplied rules before implementing them. BoyleSports settlement support
Settle a mock accumulator deterministically
An exercise gives a 10-unit stake and three legs. Decimal returns are 2.0, 1.5 and 3.0. Assume the first two win and the third is void, with void contributing multiplier 1. Gross settlement under those exercise rules is 30 units. Any losing leg takes this toy accumulator to zero. Related PracHub practice
Use Decimal or a suitable fixed-point representation and document when rounding occurs. Keep rule and outcome separate. A pending leg leaves the result pending until the contract says otherwise. An each-way variant may split the input into win and place components, each with independent settlement and an explicit rule for converting odds.
Make a corrected result auditable
If a result is corrected, append a new settlement revision tied to the new official outcome and compute the adjustment relative to the prior revision. Preserve both calculations and prevent a repeated notification from applying the same adjustment twice.
Prepare boundary cases before adding categories
Walk through an all-void accumulator, a zero or invalid stake, a fractional gross result and an update received twice. For each, show both displayed state and ledger impact.