Give the shop a daily money budget that recharges (closes #20)#100
Merged
Conversation
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
left a comment
Member
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 offtimeService.day— noTimeServicecoupling).sellFishbuys 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.randomimport.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 srccleanSDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy python3 -m pytest— 224 passedKnown 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