This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' Cheat at NYT Spelling Bee ''' | |
import random | |
class Words: | |
def __init__(self): | |
with open('/usr/share/dict/words','r') as f: | |
raw=f.read().split('\n') | |
self.words=[w.upper() for w in raw if (not "'" in w and len(w)>3 and w.islower())] | |
self.sevens=[w for w in self.words if (len(w)==7 and len(set(w))==7)] | |
def findbees(self,letters): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import scipy.special as sci | |
class stars_bars: | |
def __init__(self,nbins=4,nstars=40): | |
self.nbins=nbins | |
self.nstars=nstars | |
self.bars=[0]*(nbins-1) # bar positions; there are nbins-1 bars | |
self.bins=[0]*nbins # number of stars in each bin | |
self.stars=[0]*nstars # bin index of each star | |
self.index=0 # arrangement counter |