Some restructuring

This commit is contained in:
Dane Johnson 2023-02-08 15:04:04 -06:00
parent 2be456964a
commit 872cd8bec4
3 changed files with 57 additions and 52 deletions

View File

@ -1,11 +1,15 @@
bidict==0.22.1
click==8.1.3
colorama==0.4.6
dnspython==2.3.0
eventlet==0.33.3
Flask==2.2.2
Flask-SocketIO==5.3.2
greenlet==2.0.2
itsdangerous==2.1.2
Jinja2==3.1.2
MarkupSafe==2.1.2
python-engineio==4.3.4
python-socketio==5.7.2
six==1.16.0
Werkzeug==2.2.2

View File

@ -1,18 +1,14 @@
from flask import Flask, request
from flask_socketio import SocketIO, emit, join_room, rooms
from venture.code import make_code
from venture.game import Game
from gencode import make_code
from game import Game
games = {}
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
app = Flask('venture')
socketio = SocketIO(app, cors_allowed_origins="*")
if __name__ == '__main__':
socketio.run(app)
def with_game(listener):
global games
room = rooms()[1]
@ -26,7 +22,6 @@ def with_game(listener):
def on_newgame():
data = {}
code = make_code()
games[code] = Game(code)
join_room(code)
emit('set-code', {'code': code})
@ -39,3 +34,9 @@ def on_join_contestant(data):
join_room(room)
games[room].add_contestant(sid, signature)
emit('contestant-joined', {'sid': sid, 'signature': signature }, to=room)
def main():
socketio.run(app, host='0.0.0.0', debug=True)
if __name__ == '__main__':
main()