Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,21 @@
import random, pprint
from itertools import product, combinations
N_DRAW = 9
N_GOAL = N_DRAW // 2
deck = list(product("red green purple".split(),
"one two three".split(),
"oval squiggle diamond".split(),
"solid open striped".split()))
sets = []
while len(sets) != N_GOAL:
draw = random.sample(deck, N_DRAW)
sets = [cs for cs in combinations(draw, 3)
if all(len(set(t)) in [1, 3] for t in zip(*cs))]
print "Dealt %d cards:" % len(draw)
pprint.pprint(draw)
print "\nContaining %d sets:" % len(sets)
pprint.pprint(sets)