"""Sample policy for the Taffy Splendor API.""" def choose_action(state): # Take three distinct colors that are still available in the bank. bank = state.get("bank", {}) colors = [color for color in ("white", "blue", "green", "red", "black") if bank.get(color, 0) > 0] if len(colors) >= 3: return {"action": "take", "data": {"tokens": colors[:3]}} return {"action": "take", "data": {"tokens": colors}}