Find the next market day when holidays can move or cancel it
The market is held every seventh day, except that on a holy day it moves to the day after, or does not take place at all. Here is how to answer "when is the next market" correctly, including the awkward case where the moved market lands after the day you asked from.
Why this works
A moved event is a new date, not the old one. Asking about the date it actually lands on, rather than the date it was planned for, finds the market that was shifted into your window, and a cap keeps two markets from falling on one day.
When not to use it
Skip it when the date is set by the story or by the player, such as a festival the hero organises. Then store the exact day and show it, instead of computing it from a repeating rule and a list of holidays.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 22 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Find the next market day when holidays can move or cancel it" (read_entry weekly-market-moved-by-holidays) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP