summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-14 22:31:48 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-14 22:37:40 +0100
commit0fb08748e5285e5d4adc6135eec8889887a63299 (patch)
tree3a82c2899f33a8d4234b07799cff00865c8e141c
parentad12c67adcc8e3c0f29814b1b95959ac4b9f4a4d (diff)
use a python package instead of just modules
The package is contained in the CAO/ folder. server.py is still at the root of the repository though. Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
-rw-r--r--CAO/Board.py (renamed from CAO_Board.py)2
-rw-r--r--CAO/Cards.py (renamed from CAO_Cards.py)2
-rw-r--r--CAO/Client.py (renamed from CAO_Client.py)6
-rw-r--r--CAO/Game.py (renamed from CAO_Game.py)12
-rw-r--r--CAO/GameManager.py (renamed from CAO_GameManager.py)12
-rw-r--r--CAO/Player.py (renamed from CAO_Player.py)2
-rw-r--r--CAO/Status.py (renamed from CAO_Status.py)0
-rw-r--r--CAO/__init__.py0
-rwxr-xr-xserver.py10
9 files changed, 23 insertions, 23 deletions
diff --git a/CAO_Board.py b/CAO/Board.py
index 0fd595b..4f4e7c6 100644
--- a/CAO_Board.py
+++ b/CAO/Board.py
@@ -1,6 +1,6 @@
import random
-class CAO_Board():
+class Board():
def __init__(self, white_cards, black_cards):
self.white_pick = white_cards
self.black_pick = black_cards
diff --git a/CAO_Cards.py b/CAO/Cards.py
index 1feecef..b796b97 100644
--- a/CAO_Cards.py
+++ b/CAO/Cards.py
@@ -1,4 +1,4 @@
-class CAO_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/CAO_Client.py b/CAO/Client.py
index c3554ac..03bb68d 100644
--- a/CAO_Client.py
+++ b/CAO/Client.py
@@ -1,7 +1,7 @@
-from CAO_Status import cao_error
-from CAO_Game import CAO_Game
+from CAO.Status import cao_error
+from CAO.Game import Game
-class CAO_Client():
+class Client():
def __init__(self, socket, handler, game_manager):
self.game = None
self.game_manager = game_manager
diff --git a/CAO_Game.py b/CAO/Game.py
index aac2c57..f4123d4 100644
--- a/CAO_Game.py
+++ b/CAO/Game.py
@@ -1,11 +1,11 @@
-from CAO_Player import CAO_Player
-from CAO_Board import CAO_Board
+from CAO.Player import Player
+from CAO.Board import Board
-from CAO_Status import cao_error, cao_success
+from CAO.Status import cao_error, cao_success
import json
-class CAO_Game():
+class Game():
WAITING_NEW_JUDGE = 0,
WAITING_COLLECTION = 1,
WAITING_DESIGNATION = 2,
@@ -24,7 +24,7 @@ class CAO_Game():
self.judge = None
- self.board = CAO_Board(white_pick, black_pick)
+ self.board = Board(white_pick, black_pick)
def try_join(self, client):
if len(self.players) >= 10:
@@ -38,7 +38,7 @@ class CAO_Game():
except IndexError:
return cao_error('no enough white cards for player')
- player = CAO_Player(client)
+ player = Player(client)
for card in cards:
player.receive_card(card)
diff --git a/CAO_GameManager.py b/CAO/GameManager.py
index 8c01547..5600f1e 100644
--- a/CAO_GameManager.py
+++ b/CAO/GameManager.py
@@ -1,9 +1,9 @@
-from CAO_Game import CAO_Game
-from CAO_Cards import CAO_Cards
+from CAO.Game import Game
+from CAO.Cards import Cards
import os
-class CAO_GameManager():
+class GameManager():
def __init__(self):
self.langs = {}
@@ -11,8 +11,8 @@ class CAO_GameManager():
self.langs[filename] = {}
for lang in self.langs:
- self.langs[lang]['black_cards'] = CAO_Cards.get_black_cards(lang)
- self.langs[lang]['white_cards'] = CAO_Cards.get_white_cards(lang)
+ self.langs[lang]['black_cards'] = Cards.get_black_cards(lang)
+ self.langs[lang]['white_cards'] = Cards.get_white_cards(lang)
self.langs[lang]['games'] = {}
@@ -29,6 +29,6 @@ class CAO_GameManager():
if game is None:
print('Starting new game')
- game = games[game_name] = CAO_Game(white_cards, black_cards)
+ game = games[game_name] = Game(white_cards, black_cards)
return game
diff --git a/CAO_Player.py b/CAO/Player.py
index d08a0a1..cc64d17 100644
--- a/CAO_Player.py
+++ b/CAO/Player.py
@@ -1,6 +1,6 @@
import json
-class CAO_Player():
+class Player():
def __init__(self, client):
self.cards = {}
self.next_idx = 0
diff --git a/CAO_Status.py b/CAO/Status.py
index 782a0b4..782a0b4 100644
--- a/CAO_Status.py
+++ b/CAO/Status.py
diff --git a/CAO/__init__.py b/CAO/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/CAO/__init__.py
diff --git a/server.py b/server.py
index 7391e8e..5d117e9 100755
--- a/server.py
+++ b/server.py
@@ -1,16 +1,16 @@
#!/usr/bin/env python
from websocket_server import WebsocketServer
-import CAO_GameManager
-import CAO_Client
-from CAO_Status import cao_error
+import CAO.GameManager
+import CAO.Client
+from CAO.Status import cao_error
import json
-game_manager = CAO_GameManager.CAO_GameManager()
+game_manager = CAO.GameManager.GameManager()
def new_client_handler(client, server):
- client['cao_client'] = CAO_Client.CAO_Client(server, client, game_manager)
+ client['cao_client'] = CAO.Client.Client(server, client, game_manager)
def client_left_handler(client, server):
client['cao_client'].disconnect();