import time import threading import atexit from src.Server.Server import Server from src.Server.PlayerHandler import PlayerHandler from src.Server.RuleHandler import RuleHandler from src.Base.Rule import Rule from src.Base.OptionsParser import load_configuration start_time = time.time() def test_rule(server_object): global a a = exit config_parser = load_configuration("server") rules = [Rule('Test Rule', None, test_rule)] RH = RuleHandler(rules) PH = PlayerHandler([]) ip = config_parser.get('Misc.', 'ip') port = config_parser.getint('Misc.', 'port') players = PH.players server = Server(RH, PH, config_parser, port, ip) clients = server.clients deck = server.deck pile = server.pile print 'Server at {}:{}'.format(ip or 'localhost', port) MAIN_THREAD = threading.Thread(target = server.main_loop) print "Type 'MAIN_THREAD.start()' to start the game!" def uptime():
import threading import Queue from src.Client.Client import Client from src.Base.Card import Card from src.Base.OptionsParser import load_configuration import Tkinter # Automated login using the server configuration config = load_configuration("server") ip = config.get("Misc.", "ip") port = config.getint("Misc.", "port") name = 'Timidger' client = Client(port, ip, name) def Client_listen(): while client.is_running(): try: print client.message_queue.get(timeout = 1) except Queue.Empty: continue #threading.Thread(target = Client_listen).start() def cmd(): while client.is_running(): message = raw_input() if client.is_running(): if message.startswith('/'): command = message.split('/', 1)[1].split() if command[0] == 'pile':