コード例 #1
0
ファイル: boggle.py プロジェクト: fogleman/Boggle
def main():
    dawg.init(
        '_dawg',
        'files/sowpods.dawg',
    )
    grid = create(5)
    print '\n'.join(grid)
    words = solve(grid, 4)
    print len(words)
    print sum(score(x) for x in words)
    print words
コード例 #2
0
ファイル: __init__.py プロジェクト: fogleman/Boggle
'''
Room, Chat, OpenID, Rank
'''

# Constants
ACTIVE_TIMEOUT = 10

# Flask
app = Flask(__name__)
app.config['SECRET_KEY'] = '\x12\x83\xe2\x11\xd8%4aH\x86\xae\x18\xd6R\xe8A\xd0F\x03\xfc\x9b)J\x8f'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///database.db'
db = SQLAlchemy(app)
cache = SimpleCache()

dawg.init(
    os.path.join(app.root_path, '_dawg'),
    os.path.join(app.root_path, 'files/sowpods.dawg'),
)

# Models
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    uuid = db.Column(db.String(64), nullable=False, unique=True)
    remote_addr = db.Column(db.String(64), nullable=False)
    timestamp = db.Column(db.DateTime, nullable=False)
    def __init__(self, uuid, remote_addr, timestamp):
        self.uuid = uuid
        self.remote_addr = remote_addr
        self.timestamp = timestamp
    def __repr__(self):
        return '<User %r>' % self.id