summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2011-11-30 08:24:12 +0100
committerDominique Martinet <asmadeus@codewreck.org>2011-11-30 08:24:12 +0100
commit25bccf2925f7fe16569d4bf7e5222d98de02ddb7 (patch)
tree4e5510339217bc8f210fa0d449fe1444b464c75f
parent871745156d679f82f3be060af83dfd51a3416f09 (diff)
added an error for unknown argument, changed bot default level
-rw-r--r--TrollTron.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/TrollTron.cpp b/TrollTron.cpp
index ca28e23..a8af7d7 100644
--- a/TrollTron.cpp
+++ b/TrollTron.cpp
@@ -1,6 +1,7 @@
// TrollTron.cpp : définit le point d'entrée pour l'application console.
#include <iostream>
+#include <string.h>
#include <time.h>
#include "MainWindow.h"
#include "KeyboardController.h"
@@ -35,7 +36,8 @@ int main(int argc, char **argv) {
//We don't start the game and display the usage
bool argFail = false;
// The higher the easier
- int botDifficulty;
+ int botInhibitDelay;
+ int botRandomTurn;
// Start at 1 because 0 is the path/name
int argNum=1;
// We need this to see if we have either 0, 2 or 4 numbers passed and where to store them
@@ -82,27 +84,29 @@ int main(int argc, char **argv) {
// If it's "easy"
if(! strcmp(argv[argNum], "easy"))
{
-
isABot = true;
- botDifficulty = 10;
+ botInhibitDelay = 10;
+ botRandomTurn = 10;
}
else if(! strcmp(argv[argNum], "medium"))
{
isABot = true;
- botDifficulty = 3;
+ botInhibitDelay = 3;
+ botRandomTurn = 6;
}
else if(! strcmp(argv[argNum], "hard"))
{
isABot = true;
- botDifficulty = 1;
- }
+ botInhibitDelay = 1;
+ botRandomTurn = 3;
+ } else argFail = true;
if(isABot)
{
// Count 1 more (non human) player
currNumPlayers ++;
pPlayer = game.addPlayer();
// And instanciate its AI
- pPlayer->setController(new AIController(pPlayer, game.getField(), botDifficulty, botDifficulty));
+ pPlayer->setController(new AIController(pPlayer, game.getField(), botInhibitDelay, botRandomTurn));
}
}