def InvertDirection(direction: int) -> int:
    """Returns the opposite direction to the one given.
    """
    if direction == 0:
        return 1
    elif direction == 1:
        return 0
    elif direction == 2:
        return 3
    else:
        return 2