def map_rcs_to_snake(nh, nv, row, col, spin):
    """Mapping (row, column, spin-type) to snake encoding.

    Args:
        nhoriz -- number of horizontal sites
        nvert -- number of vertical sites
        row -- row location of the qubit in the lattice
        col -- column location of the qubit in the lattice
        spin -- spin-type: up or down

    Returns:
        Number of snake encoded qubit
    """
    return 2 * nh * row + col + nh * spin