ipa not sfd
authorSamuel Moore <[email protected]>
Thu, 19 Jan 2012 05:54:47 +0000 (13:54 +0800)
committerSamuel Moore <[email protected]>
Thu, 19 Jan 2012 05:54:47 +0000 (13:54 +0800)
Derp

agents/vixen/vixen.py
judge/manager/network_controller.cpp
judge/manager/network_controller.h

index 3aa47cb..7c44aa3 100755 (executable)
@@ -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"]
index aed27b7..6d56554 100644 (file)
@@ -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;
index cf80a80..a64ad30 100644 (file)
@@ -8,7 +8,7 @@
 #include <unistd.h>
 #include <netdb.h>
 #include <fcntl.h>
-
+#include <errno.h>
 
 
 #include "controller.h"

UCC git Repository :: git.ucc.asn.au