Creating a coroutine in Lua runs nothing yet. The host calls coroutine.resume, and only then does the generator run, up to the point where it explicitly yields a proposal. One tile at a time.
A red tile is already accepted. The generator yields a blue square for the neighbouring position. That yield is where control changes hands. The user rejects it and asks for amber. The host resumes the suspended coroutine with that decision, and the generator reads it from the values its coroutine.yield call returns. Then it prepares another proposal.
What does the rejection change? The palette position could advance, stay put, or roll back to the state from before the proposal. Each gives the artist a different way of revising. Keeping the rejected proposal and the decision visible would explain why the next tile looks different.
If the user stops, the host just stops resuming. The coroutine is left suspended, not finished, so the application needs a policy for the state and resources it still holds.
I lean toward leaving the position where it was, so a rejection costs nothing. Has anyone tried the other two with people actually drawing?
