Skip to content

Instantly share code, notes, and snippets.

@amiller
Last active August 29, 2015 14:12
Show Gist options
  • Save amiller/b663b6c7549d4b67b5c8 to your computer and use it in GitHub Desktop.
Save amiller/b663b6c7549d4b67b5c8 to your computer and use it in GitHub Desktop.
liarsdice
import zmq
def main():
context = zmq.Context()
port = 8599
serv = context.socket(zmq.REP)
serv.bind("tcp://*:%s" % port)
server(serv)
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