import random


def roll_dice(adv, disadv, seed):
    """
    Roll the dice. If advantage or disadvantage flags are used,
    roll the d20 twice and take the higher/lower number.
    """
    if seed:
        random.seed(seed)

    if adv or disadv:
        roll1 = random.randint(1, 20)
        roll2 = random.randint(1, 20)
        if adv:
            roll = max(roll1, roll2)
        else:
            roll = min(roll1, roll2)
        return [roll, roll1, roll2]

    roll = random.randint(1, 20)
    return [roll]