Skip to content

Give the shop a daily money budget that recharges (closes #20)#100

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/shop-money-recharge
Jun 13, 2026
Merged

Give the shop a daily money budget that recharges (closes #20)#100
dmccoystephenson merged 1 commit into
mainfrom
feature/shop-money-recharge

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Implements #20 ("make the shop's money recharge over time").

Design decision (made per request): the budget gates selling — otherwise shop money is meaningless flavor — but it's tuned to be forgiving.

  • src/location/shop.py: the shop holds a daily budget (SHOP_DAILY_BUDGET = 750) that refills lazily at the start of each new day (_refillIfNewDay, keyed off timeService.day — no TimeService coupling).
  • sellFish buys your fish most-valuable-first until the budget runs out; unaffordable fish stay in your inventory, with a clear "shop is out of money for today — come back tomorrow" message. A normal catch sells cleanly; only large hauls hit the cap.
  • No persistence/schema change (the shop isn't saved) — budget starts full and refills daily. Removed the now-unused random import.
  • README: brief "Selling Fish" note on the daily budget.

Balance (playtest simulation on the real game code)

At $750/day: optimal reinvest slows only mildly (~20 → ~24 days to $10k), the steady-income business strategy stays competitive (~25), and plain grind is ~113. The budget adds a real "sell regularly / bank your wealth" constraint without crippling skilled play (checked $500/$750/$1000 and picked $750).

Test plan

  • python3 -m compileall -q src clean
  • SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy python3 -m pytest — 224 passed
  • New tests: budget gates a large haul (leftovers + "out of money" message), budget refills next day, and the no-fish message. Existing sell tests (normal catch, legacy aggregate, sell-by-species) still pass under the budget.

Known limitation

The shop's budget isn't persisted, so it resets to full on reload — but since a normal Sleep already refills it (plus restoring energy and paying interest/crew), reload-to-refill is strictly worse than just sleeping and isn't a useful exploit. Persisting it would require reintroducing shop save state; noted for a possible follow-up.

Closes #20

🤖 Generated with Claude Code

Implements the long-standing "make the shop's money recharge over time" goal.
The shop now holds a daily budget (SHOP_DAILY_BUDGET, $750) that refills at the
start of each new day. When you sell, it buys your fish most-valuable-first
until the budget runs out; any unaffordable fish stay in your inventory to sell
another day, and a clear message tells you the shop is tapped out for today.

Design call: the budget gates selling (otherwise shop money is meaningless
flavor), but it's tuned to cover a normal day's catch and only bite on very
large hauls — so it adds "sell regularly / store wealth in the bank" texture
without being a daily wall. Verified with the playtest simulation: the optimal
reinvest strategy slows only mildly (~20 -> ~24 days to the goal) and the
steady-income business strategy stays competitive (~25).

No persistence/schema change — the shop isn't saved, so its budget simply
starts full and refills daily. Removed the now-unused `random` import.

Closes #20

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@dmccoystephenson dmccoystephenson left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review:

  • Scope: PASS — shop.py + its tests + a README note; all serve #20.
  • Tests-fix/new: PASS — budget-gating/refill/no-fish tests; the gating test fails under the old sell-everything code; existing sell tests (normal/legacy/by-species) still pass.
  • Schema/save-safety: PASS — shop isn't persisted, so no schema/reader-writer change; not a protected path.
  • Design call: gating chosen deliberately and tuned via the playtest sim ($750 → reinvest ~24, business ~25); documented + known reload limitation noted.
  • Clean-up: removed the now-unused random import. Money-format: messages use %.2f. CI: PASS.

@dmccoystephenson dmccoystephenson merged commit cb3fd4c into main Jun 13, 2026
1 check passed
@dmccoystephenson dmccoystephenson deleted the feature/shop-money-recharge branch June 13, 2026 21:24
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.

Make the shop's money recharge over time.

1 participant