import torch


def generate_deck_matrix(deck, card_index, v):
    """
    Generate a binary matrix of shape len(deck) * V * V, where
    row c in the i_th channel represents the i_th card is of
    color c
    """
    matrix = torch.zeros((len(deck), v, v))
    for i in range(card_index, len(deck)):
        c = deck[i]
        for j in range(v):
            matrix[i][c][j] = 1
    return matrix