#!/usr/bin/env python3 """ Entry point to play the game. """ import argparse import asyncio import logging from websockets.server import serve from swiftstory.game_manager import GameManager from swiftstory.interface.ws import WebsocketsInterface def main(): """ Entry point: we create the game manager and start the Websockets server. """ parser = argparse.ArgumentParser() parser.add_argument('--listen', type=str, default='0.0.0.0') parser.add_argument('--port', type=int, default=1236) args = vars(parser.parse_args()) logging.basicConfig(level=logging.INFO) ws_interface = WebsocketsInterface(GameManager()) start_server = serve(ws_interface.connection_handler, args['listen'], args['port']) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() if __name__ == '__main__': main()