import re


def parse_move(text):
    """Parse a Prisoner's Dilemma game move from text

    :param text: tex of the tweet containg the move
    :raises ValueError: raises an exception if no valid move can be found
    :return: True for COOPERATE and False for DEFECT
    """
    text = re.sub("@[a-zA-Z0-9_]{1,15}", "", text).upper().strip()

    # Check for cooperate
    if "COOPERATE" in text:
        return True

    # Check for C
    if text == "C":
        return True

    # Check for cooperate emoji
    if "✅" in text:
        return True

    # Check for defect
    if "DEFECT" in text:
        return False

    # Check for D
    if text == "D":
        return False

    # Check for defect emoji
    if "❌" in text:
        return False

    # Raise exception if no valid move was found
    raise ValueError("No valid move found")