Skip to content
Snippets Groups Projects
Commit 6066930d authored by Sam Moore's avatar Sam Moore
Browse files

Did some stuff

Probably should have committed immediately after I did whatever the stuff was? Not several weeks later?

I appear to have improved the vixen AI slightly

Aha, I remember! Altered manager program so that two ports are used (4560 and 4561) instead of just one.
This means you can use network controllers for both players, not just one.
parent 341297b4
Branches
No related merge requests found
...@@ -28,9 +28,9 @@ class Vixen(BasicAI): ...@@ -28,9 +28,9 @@ class Vixen(BasicAI):
#self.bombScores = {'1' : -0.9 , '2' : -0.8 , '3' : -0.5 , '4' : 0.1, '5' : 0.1, '6' : 0.3, '7' : 0.7, '8' : 1 , '9' : 0.6, 's' : 0} #self.bombScores = {'1' : -0.9 , '2' : -0.8 , '3' : -0.5 , '4' : 0.1, '5' : 0.1, '6' : 0.3, '7' : 0.7, '8' : 1 , '9' : 0.6, 's' : 0}
#self.bombScores = {'1' : -0.9 , '2' : -0.8 , '3' : -0.5 , '4' : -0.5, '5' : -0.4, '6' : -0.5, '7' : -0.2, '8' : 1.0 , '9' : -0.1, 's' : -0.2} #self.bombScores = {'1' : -0.9 , '2' : -0.8 , '3' : -0.5 , '4' : -0.5, '5' : -0.4, '6' : -0.5, '7' : -0.2, '8' : 1.0 , '9' : -0.1, 's' : -0.2}
self.suicideScores = {'1' : -0.5 , '2' : -0.4 , '3' : -0.35, '4' : -0.25, '5' : -0.2, '6' : 0.0, '7' : 0.1, '8' : -1.0 , '9' : 0.0, 's' : -0.4} self.suicideScores = {'1' : -0.8 , '2' : -0.6 , '3' : -0.5, '4' : -0.25, '5' : -0.2, '6' : 0.0, '7' : 0.1, '8' : -1.0 , '9' : 0.0, 's' : -0.4}
self.killScores = {'1' : 1.0 , '2' : 0.9 , '3' : 0.9 , '4' : 0.8, '5' : 0.8, '6' : 0.8, '7' : 0.8, '8' : 0.9 , '9' : 0.7, 's' : 1.0} self.killScores = {'1' : 1.0 , '2' : 0.9 , '3' : 0.9 , '4' : 0.8, '5' : 0.8, '6' : 0.8, '7' : 0.8, '8' : 0.9 , '9' : 0.7, 's' : 1.0}
self.riskScores = {'1' : 0.0, '2' : 0.1, '3' : 0.2, '4': 0.4, '5': 0.6, '6': 0.7, '7':0.8, '8': 0.0, '9' : 1.0, 's' : 0.1} self.riskScores = {'1' : -0.3, '2' : -0.3, '3' : 0.0, '4': 0.4, '5': 0.6, '6': 0.7, '7':0.8, '8': 0.0, '9' : 1.0, 's' : 0.1}
...@@ -132,7 +132,7 @@ class Vixen(BasicAI): ...@@ -132,7 +132,7 @@ class Vixen(BasicAI):
if attackerRank == '8': if attackerRank == '8':
return 1.0 return 1.0
else: else:
return 0.0 return self.suicideScore(attackerRank)
def suicideScore(self, attackerRank): def suicideScore(self, attackerRank):
return self.suicideScores[attackerRank] return self.suicideScores[attackerRank]
......
...@@ -771,6 +771,9 @@ void Game::MakeControllers(const char * redPath, const char * bluePath) ...@@ -771,6 +771,9 @@ void Game::MakeControllers(const char * redPath, const char * bluePath)
{ {
Network * redNetwork = NULL; Network * redNetwork = NULL;
Network * blueNetwork = NULL; Network * blueNetwork = NULL;
//To allow for running two network controllers (I don't know why you would, but beside the point...) use two ports
static const int port1 = 4560;
static const int port2 = 4561;
if (redPath[0] == '@') if (redPath[0] == '@')
{ {
...@@ -789,7 +792,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath) ...@@ -789,7 +792,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath)
if (network == NULL) if (network == NULL)
{ {
logMessage("Creating server for red AI... "); logMessage("Creating server for red AI... ");
redNetwork = new Server(); redNetwork = new Server(port1);
logMessage("Successful!\n"); logMessage("Successful!\n");
} }
...@@ -797,7 +800,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath) ...@@ -797,7 +800,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath)
{ {
network = (const char*)(network+1); network = (const char*)(network+1);
logMessage("Creating client for red AI... "); logMessage("Creating client for red AI... ");
redNetwork = new Client(network); redNetwork = new Client(network, port2);
logMessage("Connected to address %s\n", network); logMessage("Connected to address %s\n", network);
} }
...@@ -825,7 +828,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath) ...@@ -825,7 +828,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath)
if (network == NULL) if (network == NULL)
{ {
logMessage("Creating server for blue AI... "); logMessage("Creating server for blue AI... ");
blueNetwork = new Server(); blueNetwork = new Server(port2);
logMessage("Successful!\n"); logMessage("Successful!\n");
} }
...@@ -833,7 +836,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath) ...@@ -833,7 +836,7 @@ void Game::MakeControllers(const char * redPath, const char * bluePath)
{ {
network = (const char*)(network+1); network = (const char*)(network+1);
logMessage("Creating client for blue AI... "); logMessage("Creating client for blue AI... ");
blueNetwork = new Client(network); blueNetwork = new Client(network, port1);
logMessage("Connected to address %s\n", network); logMessage("Connected to address %s\n", network);
} }
logMessage(" (Blue's responses will be received over the connection)\n"); logMessage(" (Blue's responses will be received over the connection)\n");
......
...@@ -215,7 +215,7 @@ void Graphics::Initialise(const char * caption, int newWidth, int newHeight) ...@@ -215,7 +215,7 @@ void Graphics::Initialise(const char * caption, int newWidth, int newHeight)
//COMES AFTER SETVIDEO MODE //COMES AFTER SETVIDEO MODE
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glClearColor(1,1,1,0); //Set clear colour (white) here glClearColor(0,0,0,0); //Set clear colour (white) here
glViewport(0,0,screenWidth,screenHeight); //DOES matter glViewport(0,0,screenWidth,screenHeight); //DOES matter
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
class Network class Network
{ {
public: public:
Network(int newPort = 666); Network(int newPort = 4560);
virtual ~Network(); virtual ~Network();
bool Valid() const {return sfd != -1;} bool Valid() const {return sfd != -1;}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment