def terminal(model_state):
    """ Return true if the state should end the episode. This includes both
        failure terminals (such as when the model isout-of-bounds) and success
        terminals (when the model is in a successful state)
    """
    dealerWins = model_state[18];

    # We use the dealerWin status to determine whether to terminate the episode
    return (dealerWins != 0)