Skip to content

Instantly share code, notes, and snippets.

@jamesmaa
jamesmaa / .py
Created January 6, 2018 05:57
Set Card Game Simulations
from itertools import product, combinations
from random import shuffle
from collections import OrderedDict, Counter
def is_set(c1, c2, c3):
for i in range(4):
if c1[i] == c2[i] == c3[i]:
continue
elif c1[i] != c2[i] and c2[i] != c3[i] and c3[i] != c1[i]:
@jamesmaa
jamesmaa / .py
Created February 7, 2018 21:10
Raymond Birthday Moving Average
birthdays = [date(year=1990+x, month=2, day=18) for x in range(5000)]
def avg(birthdays):
return float(len(birthdays)) / len([b for b in birthdays if b.weekday() == 6])
moving_avg = [avg(birthdays[:x]) for x in range(1, 5000)]
plt.plot(moving_avg)
plt.show()