import random


def generate_grid(height = 10, width = 10, seed = None, sparcity = 75, separator = "#", gap = "."):
    """Create empty grid as base for crossword
    :param height: number of rows in puzzle <1, 1000>
    :param width: number of columns in puzzle <1, 1000>
    :param seed: number used as seed in RNG
    :param sparcity: percentage of grid to fill with characters (0, 100)
    :param separator: character used as BLANK
    :param gap: character used to indicate space to fill
    :raise ValueError: if arguments have incorrect value
    :raise TypeError: if arguments have incorrect type
    :returns: empty grid
    """
    if not 1 <= height <= 1000:
        raise ValueError("Incorrect height")
    if not 1 <= width <= 1000:
        raise ValueError("Incorrect width")
    if not 0 < sparcity < 100:
        raise ValueError("Incorrect sparcity")
    if not (separator.isascii() and len(separator)==1):
        raise TypeError("Separator has to be single character")
    if not (gap.isascii() and len(gap)==1):
        raise TypeError("Gap has to be single character")
    if separator==gap:
        raise ValueError("Separator cannot be equal to gap character")
        
    random.seed(seed)    

    grid = [[gap for x in range(width)] for y in range(height)]
    for stop in random.sample(range(0, height * width), (100 - sparcity)*(height * width)//100):
        grid[stop//width][stop%width] = separator
    
    return grid