[scheduler]
    [[events]]
        abort on stall timeout = True
        stall timeout = PT0S
[scheduling]
    cycling mode = integer
    initial cycle point = 1
    final cycle point = 3
    [[graph]]
        P1 = """
            fin[-P1] => showdown

            showdown:good? => good & ! bad & ! ugly
            showdown:bad? => bad & ! good & ! ugly
            showdown:ugly? => ugly & ! good & ! bad

            # Note: The above implies:
            # showdown:good => good
            # showdown:bad => bad
            # showdown:ugly => ugly
            # showdown:good & showdown:bad => ! ugly
            # showdown:good & showdown:ugly => ! bad
            # showdown:bad & showdown:ugly => ! good

            (good & bad) | (bad & ugly) | (ugly & good) => fin
        """
[runtime]
    [[showdown]]
        script = """
if ((${CYLC_TASK_CYCLE_POINT} == 1)); then
    cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" 'bad' 'ugly'
elif ((${CYLC_TASK_CYCLE_POINT} == 2)); then
    cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" 'good' 'ugly'
else
    cylc message -- "${CYLC_WORKFLOW_ID}" "${CYLC_TASK_JOB}" 'good' 'bad'
fi
"""
        [[[outputs]]]
            good = good
            bad = bad
            ugly = ugly
    [[good, bad, ugly, fin]]
        script = true
