def _offspring_by_genotype(W, x):
    """Number of offspring by genotype."""
    assert W.shape == (4, 4, 4)
    offspring_by_mother = W.sum(axis=2)
    offspring_by_genotype = offspring_by_mother.dot(x)
    return offspring_by_genotype