From: Samuel Moore Date: Thu, 19 Jan 2012 05:54:47 +0000 (+0800) Subject: ipa not sfd X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=4d45373e18e4d5dc84adb373cdc9000f83dfe38a;p=progcomp2012.git ipa not sfd Derp --- diff --git a/agents/vixen/vixen.py b/agents/vixen/vixen.py index 3aa47cb..7c44aa3 100755 --- a/agents/vixen/vixen.py +++ b/agents/vixen/vixen.py @@ -67,9 +67,9 @@ class Vixen(BasicAI): moveList.sort(key = lambda e : e["score"], reverse=True) #sys.stderr.write("vixen - best move: " + str(moveList[0]["unit"].x) + " " + str(moveList[0]["unit"].y) + " " + moveList[0]["direction"] + " [ score = " + str(moveList[0]["score"]) + " ]\n") - if moveList[0]["score"] == 0: - print "NO_MOVE" - return True + #if moveList[0]["score"] == 0: + # print "NO_MOVE" + # return True print str(moveList[0]["unit"].x) + " " + str(moveList[0]["unit"].y) + " " + moveList[0]["direction"] diff --git a/judge/manager/network_controller.cpp b/judge/manager/network_controller.cpp index aed27b7..6d56554 100644 --- a/judge/manager/network_controller.cpp +++ b/judge/manager/network_controller.cpp @@ -5,9 +5,10 @@ NetworkController::NetworkController(const Piece::Colour & newColour, const char struct protoent * tcp = getprotobyname("tcp"); sfd = socket(PF_INET, SOCK_STREAM, tcp->p_proto); - if (sfd == -1) + if (sfd < 0) { - fprintf(stderr, "NetworkController::NetworkController - couldn't create a TCP socket!"); + // fprintf(stderr, "NetworkController::NetworkController - couldn't create a TCP socket!"); + perror("NetworkController::NetworkController - creating TCP socket... "); return; } } @@ -18,7 +19,8 @@ NetworkController::~NetworkController() { if (shutdown(sfd, SHUT_RDWR) == -1) { - fprintf(stderr, "NetworkController::~NetworkController - Can't shutdown socket %d!", sfd); + // fprintf(stderr, "NetworkController::~NetworkController - Can't shutdown socket %d!", sfd); + perror("NetworkController::~NetworkController - shutting down socket... "); close(sfd); sfd = -1; } @@ -34,9 +36,10 @@ Server::Server(const Piece::Colour & newColour, const char * newName) : NetworkC ipa.sin_addr.s_addr = INADDR_ANY; memset(&ipa,0, sizeof ipa); - if (bind(sfd, (struct sockaddr*)&sfd, sizeof sfd) == -1) + if (bind(sfd, (struct sockaddr*)&ipa, sizeof (ipa)) == -1) //dERP DERP DERP { - fprintf(stderr, "Server::Server - Couldn't bind to socket! Abort\n"); + // fprintf(stderr, "Server::Server - Couldn't bind to socket! Abort\n"); + perror("Server::Server - binding to socket... "); close(sfd); sfd = -1; return; diff --git a/judge/manager/network_controller.h b/judge/manager/network_controller.h index cf80a80..a64ad30 100644 --- a/judge/manager/network_controller.h +++ b/judge/manager/network_controller.h @@ -8,7 +8,7 @@ #include #include #include - +#include #include "controller.h"