Created
March 25, 2014 03:55
-
-
Save atomictom/9754995 to your computer and use it in GitHub Desktop.
This file contains 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
# Pseudo code for the sockets | |
# Game | |
def connection(player, socket=zqm.socket(zqm.REQ)): | |
while True: | |
# Send to the NN | |
info = player.get_info() | |
info_p = info.pickle() | |
socket.send(info_p) | |
# Recv from the NN | |
reply = socket.recv() | |
reply_list = reply.unpickle() | |
for r in reply_list: | |
player.notify(r) | |
def main() | |
threading.Thread(connection).start() | |
# ------------------------------------------------------------ | |
# NN | |
def connection(NN, socket=zqm.socket(zqm.REP)): | |
while True: | |
# Recv from the game | |
info = socket.recv() | |
info_p = info.unpickle() | |
NN.update_input(info_p) | |
# Send the NN's results to the game | |
results = NN.get_results() | |
results_p = results.pickle() | |
socket.send(results_p) | |
def main() | |
threading.Thread(connection).start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment