test
Last active
August 29, 2015 14:12
-
-
Save amiller/b663b6c7549d4b67b5c8 to your computer and use it in GitHub Desktop.
liarsdice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
def main(): | |
context = zmq.Context() | |
port = 8599 | |
serv = context.socket(zmq.REP) | |
serv.bind("tcp://*:%s" % port) | |
server(serv) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import zmq | |
def server(): | |
class Player(): | |
def __init__(n, sock): | |
pass | |
class Game(object): | |
def __init__(players=4, dice=5, sides=6): | |
self.players = [] | |
def apply_move(player, bid): | |
if not | |
pass | |
game = Game() | |
# Create a listening server for a new game | |
# When a client connects | |
def client(socket, game): | |
while True: | |
# Read a message from the server | |
# if it's a message then send it | |
# if it's not the players turn, reject it | |
while True: | |
pass | |
def main(): | |
port = 8599 | |
serv = context.socket(zmq.REP) | |
serv.bind("tcp://*:%s" % port) | |
server(serv) | |
if __name__ == '__main__': | |
if not 'context' in globals(): | |
context = zmq.Context() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment