summaryrefslogtreecommitdiff
path: root/swiftstory
diff options
context:
space:
mode:
Diffstat (limited to 'swiftstory')
-rw-r--r--swiftstory/Board.py3
-rw-r--r--swiftstory/Cards.py2
-rw-r--r--swiftstory/Client.py4
-rw-r--r--swiftstory/Game.py7
-rw-r--r--swiftstory/GameManager.py5
-rw-r--r--swiftstory/Player.py3
-rw-r--r--swiftstory/Status.py1
-rw-r--r--swiftstory/SwiftStory.py3
8 files changed, 17 insertions, 11 deletions
diff --git a/swiftstory/Board.py b/swiftstory/Board.py
index 4f4e7c6..f69c2d0 100644
--- a/swiftstory/Board.py
+++ b/swiftstory/Board.py
@@ -1,6 +1,7 @@
import random
-class Board():
+
+class Board:
def __init__(self, white_cards, black_cards):
self.white_pick = white_cards
self.black_pick = black_cards
diff --git a/swiftstory/Cards.py b/swiftstory/Cards.py
index 78dd64a..ce54223 100644
--- a/swiftstory/Cards.py
+++ b/swiftstory/Cards.py
@@ -1,4 +1,4 @@
-class Cards():
+class Cards:
@staticmethod
def get_white_cards(lang):
''' Read the file containing the white cards and return a list of cards '''
diff --git a/swiftstory/Client.py b/swiftstory/Client.py
index b13e68b..e7c0464 100644
--- a/swiftstory/Client.py
+++ b/swiftstory/Client.py
@@ -3,7 +3,8 @@ import websockets
from swiftstory.Status import error
from swiftstory.Game import Game
-class Client():
+
+class Client:
def __init__(self, socket, game_manager):
self.game = None
self.game_manager = game_manager
@@ -28,6 +29,7 @@ class Client():
def set_game(self, game):
self.game = game
+
def set_player(self, player):
self.player = player
diff --git a/swiftstory/Game.py b/swiftstory/Game.py
index 7e7da09..9885182 100644
--- a/swiftstory/Game.py
+++ b/swiftstory/Game.py
@@ -1,16 +1,15 @@
+import json
+
from swiftstory.Player import Player
from swiftstory.Board import Board
-
from swiftstory.Status import error, success
-import json
-class Game():
+class Game:
WAITING_NEW_JUDGE = 0,
WAITING_COLLECTION = 1,
WAITING_DESIGNATION = 2,
-
def __init__(self, white_desc, black_desc):
self.white_desc = white_desc
self.black_desc = black_desc
diff --git a/swiftstory/GameManager.py b/swiftstory/GameManager.py
index 7cdb5da..e3b5e78 100644
--- a/swiftstory/GameManager.py
+++ b/swiftstory/GameManager.py
@@ -1,9 +1,10 @@
+import os
+
from swiftstory.Game import Game
from swiftstory.Cards import Cards
-import os
-class GameManager():
+class GameManager:
def __init__(self):
self.langs = {}
diff --git a/swiftstory/Player.py b/swiftstory/Player.py
index a1d6cda..3380908 100644
--- a/swiftstory/Player.py
+++ b/swiftstory/Player.py
@@ -1,6 +1,7 @@
import json
-class Player():
+
+class Player:
def __init__(self, client):
self.cards = {}
self.next_idx = 0
diff --git a/swiftstory/Status.py b/swiftstory/Status.py
index 4e8c84d..fb8347b 100644
--- a/swiftstory/Status.py
+++ b/swiftstory/Status.py
@@ -1,5 +1,6 @@
import json
+
def error(msg, code=255):
return json.dumps({'type': 'response', 'content': {'status': code, 'info': msg}})
diff --git a/swiftstory/SwiftStory.py b/swiftstory/SwiftStory.py
index e77363d..de3eab8 100644
--- a/swiftstory/SwiftStory.py
+++ b/swiftstory/SwiftStory.py
@@ -2,13 +2,13 @@
import argparse
import asyncio
+import json
import websockets
import swiftstory.GameManager
from swiftstory.Client import Client
from swiftstory.Status import error
-import json
game_manager = swiftstory.GameManager.GameManager()
@@ -79,5 +79,6 @@ def main():
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
+
if __name__ == '__main__':
main()