#3 horizontal,
#3 vertical,
#2 diagonals
WINS = [{3, 4, 5},
{6, 7, 8},
{9, 10, 11},
{3, 6, 9},
{4, 7, 10},
{5, 8, 11},
{3, 7, 11},
{5, 7, 9}]
def dice36() :
"""
Creates 36 dice rolls.
Parameters:
none
Returns:
rolls - List of 36 ordered pairs (d1, d2), the sample space of two dice.
"""
#Output list.
rolls = []
for i in range(1, 7) :
for j in range(1, 7) :
rolls.append((i, j))
return(rolls)
def countWins() :
"""
Counts wins in Tic-Tac-Deal 2.0 for d dice.
Parameters:
d - Number of dice rolled
Returns:
wins
"""
start = time.time()
W = 0
for r1 in dice36() :
for r2 in dice36() :
for r3 in dice36() :
for r4 in dice36() :
for r5 in dice36() :
for r6 in dice36() :
result = {sum(r1), sum(r2), sum(r3), sum(r4), sum(r5), sum(r6)}
for w in WINS :
if w.issubset(result) :
W += 1
break
print(time.time() - start)
return(W)