Optimizing odds calculator I am trying to setup an odds calculator for a best of 7 series, given independent odds for each event.

The following code works, but I would like to add recursion to simplify the end.

public class Game
{
    public int No { get; set; }
    public List&lt;decimal&gt; Odds;

    public Game(int no, decimal odd1, decimal odd2)
    {
        No = no;

        Odds = new List&lt;decimal&gt;();

        Odds.Add(odd1);
        Odds.Add(odd2);
    }

  }

void Main()
{

    var games = new List&lt;Game&gt;();

    var homeodd = .6m;
    var awayodd = .4m;

    var winningOdds = 0m;

//Add  7 games each with a different odd of winning game
    games.Add(new Game(1,homeodd,awayodd));
    games.Add(new Game(2,homeodd,awayodd));
    games.Add(new Game(3,awayodd,homeodd));
    games.Add(new Game(4,awayodd,homeodd));
    games.Add(new Game(5,awayodd,homeodd));
    games.Add(new Game(6,homeodd,awayodd));
    games.Add(new Game(7,homeodd,awayodd));

//game one has 2 possible outcomes, 0 = win, 1 = loss =&gt;same for all 7 games
    for (int i = 0; i &lt; 2; i++)
    {
        for (int j = 0; j &lt; 2; j++)
        {
            for (int k = 0; k &lt; 2; k++)
            {
                for (int l = 0; l &lt; 2; l++)
                {
                    for (int m = 0; m &lt; 2; m++)
                    {
                        for (int n = 0; n &lt; 2; n++)
                        {
                            for (int o = 0; o &lt; 2; o++)
                            {
                                if ((i+j+k+l+m+n+o)&lt;4)  //if we have loss less than 4 games, we have won the series and we want to add the odds of that possibility to the total odds
                                {
                                    winningOdds += games[0].Odds[i] * games[1].Odds[j] * games[2].Odds[k] * games[3].Odds[l] * games[4].Odds[m] * games[5].Odds[n] * games[6].Odds[o];
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    Console.WriteLine(winningOdds); 
}
Basically, what you need is a Cartesian product of 7 sequences, each containing a 0 and a 1. Eric Lippert has an interesting article about doing just that using LINQ (note: I think you could make his code more efficient using immutable collections). If you use his method, your code could look something like:
var product = CartesianProduct(Enumerable.Repeat(new[] { 0, 1 }, games.Count));

foreach (var indexes in product)
{
    if (indexes.Sum() &lt; 4)
    {    
        winningOdds += indexes
            .Select((index, game) =&gt; games[game].Odds[index])
            .Aggregate((x, y) =&gt; x * y);
    }
}